和 勇哥的 DpMngWebsite
------------ * 错误排除 * ------------
C#:
public static void RegisterBundles(BundleCollection bundles)
{
bundles.Add(new ScriptBundle("~/bundles/AngularJs").Include(
"~/Scripts/angular.js", "~/Scripts/angular*"));
Aspx:
<html lang="en" ng-app="enron">
<head runat="server">
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title><%: Page.Title %></title>
<asp:PlaceHolder runat="server">
<%: Scripts.Render("~/bundles/AngularJs") %>
<%: Scripts.Render("~/bundles/modernizr") %>
</asp:PlaceHolder>
错误:VS蹦出错误:“无效的字符” 并且显示Angular-csp.css
解决:学习了http://stackoverflow.com/questions/26916671/angular-csp-css-breaking-in-chrome-extension之后,将angular-csp.css移出了Scripts的文件夹,并放入了Content文件夹。有错误是因为CSS文件被VS当成js读了。
------------------------------------
JS:
angular.module('enron').controller('NameListController', ['$rootScope', '$scope', '$routeParams', '$http', function ($rootScope, $scope, $routeParams, $http) {
$scope.sayhello = function () {
alert('hello'); return;
}
}]);
错误:
Angularjs module isn't loading correctly
解决:在 'enron' 后面加 ', [ ] '
angular.module('enron',[]).controller('NameListController', ['$rootScope', '$scope', '$http', function ($rootScope, $scope, $http) {
$scope.sayhello = function () {
alert('hello'); return;
}
}]);
------------------------------------
JS:
angular.module('enron',[]).controller('NameListController', ['$rootScope', '$scope', '$routeParams', '$http', function ($rootScope, $scope, $routeParams, $http) {
$scope.sayhello = function () {
alert('hello'); return;
}
}]);
错误:
Error: [$injector:unpr] Unknown provider: routeParamsProvider <- routeParams
解决:直接删除 routeParams
angular.module('enron',[]).controller('NameListController', ['$rootScope', '$scope', '$http', function ($rootScope, $scope, $http) {
$scope.sayhello = function () {
alert('hello'); return;
}
}]);

本文总结了初学者在学习AngularJS时遇到的常见问题,包括VS中出现的“无效字符”错误,该错误由于Angular-csp.css被误识别为js导致,解决方法是将其移到Content文件夹;另外,还提到了两个JS错误,一个是语法错误,通过在'enron'后面添加', [ ]'来解决,另一个是直接删除routeParams以修复问题。"
53940894,5635958,SurfaceView崩溃解析与解决策略,"['Android开发', 'Android基础知识', 'UI编程', 'SurfaceView']
1703

被折叠的 条评论
为什么被折叠?



