I'm using angular-routing in my asp .net mvc project here getting warning like follows while passing parameters from mvc controller and displaying it on view where i want to pass user id from mvc. Can any one help me solve it and how to make it asynchronous?
"Synchronous XMLHttpRequest on the main thread is deprecated because
of its detrimental effects to the end user's experience. For more help,
check http://xhr.spec.whatwg.org/.
VM168:289WARNING: Tried to load angular more than once."
demoController.cs (demo controller page)
public ActionResult WithParams(int? type)
{
ViewBag.Type = type;
return View();
}
demo.cshtml (view)
@{
ViewBag.Title = "WithParams";
}
<h2>WithParams</h2>
@if(ViewBag.Type==1)
{
<p>You passed 1</p>
}
else
{
<p>You Passed 2</p>
}
myapp.js (angular)
angular.module('app',['ngRoute']).config(['$routeProvider', function($routeProvider) {
$routeProvider.
when('/demo', {
templateUrl: 'demo/demo',
controller: 'demoCtrl'
}). otherwise({
redirectTo: '/'
});
}]).controller('dashCtrl' , function($scope){console.log("demo page")
}
localhost
only work on your machine. Inspect the HTML in the browser and see whether there are multiple<script>
elements trying to load angular. If there are, you need to work out where they're coming from. Most of the code you've put in the question seems to be irrelevant.@scripts
section of the view and on the_layout.cshtml
or maybe twice in the bundle.config. Hard to tell