Angular:ng-view无法正常显示

时间:2017-07-30 16:31:52

标签: asp.net angularjs asp.net-mvc visual-studio-2017

我正在尝试使用ng-view显示一个视图,但它不能正常工作。

Trips.cshtml:

  @section Scripts{
    <script src="~/lib/angular/angular.min.js"></script>
    <script src="~/lib/angular-route/angular-route.min.js"></script>
    <script src="~/js/simpleControls.js"></script>
    <script src="~/js/app-trips.js"></script>
    <script src="~/js/tripsController.js"></script>
    <script src="~/js/site.js"></script>
}

<div class="row" ng-app="app-trips">

<div ng-view></div>

应用-trips.js:

(function () {
    "use strict";
    angular.module("app-trips", ["simpleControls", "ngRoute"])
        .config(function ($routeProvider) {
            $routeProvider.when("/", {
                controller: "tripsController",
                controllerAs: "vm",
                templateUrl:" /views/tripsView.html"
            });
            $routeProvider.otherwise({ redirectTo: "/" });
        });
})();

我正试图在/ wwwroot / views中显示viewsView.html。

bower.json:

"angular" : "~1.6.5",
"angular-route" : "~1.6.5",
"jquery": "2.2.0",
"bootstrap" : "3.3.7"

tripsView.html:

<p>hello world </p>

我使用不同的非连接脚本出错:

$(function (){
########## not connected stuff
})();

错误:“不是函数”,可以连接吗?甚至认为脚本工作正常。

0 个答案:

没有答案