我在我的asp .net mvc项目中使用角度路由这里从mvc控制器传递参数并在视图中显示它我想从mvc传递用户ID时收到类似警告。任何人都可以帮我解决它以及如何使它异步吗?
"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 (演示控制器页面)
public ActionResult WithParams(int? type)
{
ViewBag.Type = type;
return View();
}
demo.cshtml (查看)
@{
ViewBag.Title = "WithParams";
}
<h2>WithParams</h2>
@if(ViewBag.Type==1)
{
<p>You passed 1</p>
}
else
{
<p>You Passed 2</p>
}
myapp.js (有角度的)
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")
}