我开发了一个小应用程序,现在我想第一次将它发布到天蓝色。
这是我第一次在任何项目中使用 Angular,但我出了点问题。我收到此错误:
错误:[$injector:unpr] 未知提供者:sProvider <- s <- MapController
这是我的控制器:
var app = angular.module("TravelPlanner", []);
var mapController = function ($scope, $http) {
lots of functions....
}
app.controller("MapController", mapController);
这是我的布局页面:
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>@ViewBag.Title - My ASP.NET Application</title>
@Styles.Render("~/Content/css")
@Styles.Render("~/Content/kendo/css")
@Scripts.Render("~/bundles/modernizr")
@Scripts.Render("~/bundles/jquery")
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&key=AIzaSyASli52h7eL3W1CSNtTrl-S71zDFATqbDg&libraries=places"></script>
@Scripts.Render("~/bundles/bootstrap")
@Scripts.Render("~/bundles/kendo")
<script src="~/ckeditor/ckeditor.js"></script>
@*<script src="//cdn.tinymce.com/4/tinymce.min.js"></script>
<script src="~/Scripts/plugin.min.js"></script>*@
</head>
<body ng-app="TravelPlanner">
<div class="container body-content" ng-controller="MapController">
@RenderBody()
</div>
@RenderSection("scripts", required: false)
</body>
为什么我会得到这个角度错误?
** 编辑 ** 这是我加载脚本的包。
bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include(
"~/Scripts/bootstrap.js",
"~/Scripts/respond.js",
"~/Scripts/Angular.js",
"~/Scripts/DropZone.js",
"~/Content/Scripts/gmaps.js",
"~/Content/Scripts/jquery.geocomplete.min.js",
"~/Scripts/jquery-ui-1.11.4.min.js",
"~/Content/Scripts/MapController.js",
"~/Content/Scripts/sweetalert.min.js"
));
mapcontroller.js 是我所有的 angular/js 代码所在的位置。(不知道为什么我没有更改捆绑包的名称,猜我很懒)