I want to use AngularJS non-SPA for my website along with ASP.NET MVC. The authentication happens through Active Directory so I find it best to use ASP.NET MVC for routing and a
Updated Answer:
Since you are not using Angularjs routing, you can use ngInit
. It will initialize a new variable in your controller's scope and you will be able to access it like:
HTML (inside your controller):
<AnyElement ng-init="roomID = @ViewBag.roomID"></AnyElement>
JavaScript:
var roomID = $scope.roomID;
For more explanations see ngInit documentation.
Original Answer:
In Angularjs you can access the query string parameter very easily like:
var paramValue = $routeParams.yourParameterName;
Or if you want to initialize a JavaScript variable then consider using ngInit
. It will initialize a new variable in your controller's scope and you will be able to access it like:
HTML (inside your controller):
<AnyElement ng-init="roomID = @ViewBag.roomID"></AnyElement>
JavaScript:
var roomID = $scope.roomID;
For more explanations see ngInit documentation.
Hope that helps.