我试图解决这个问题,但很长一段时间都无法找到解决方案。我是一个有角度的新手,并试图让我的网站回家一个有角度的应用程序。角应用程序有一个控制器和2-3个指令。在页面的头部我有: Home.cshtml:
<head>
//Some other stuff....
<script src="/Scripts/angular.min.js" type="text/javascript"></script>
<script src="/Scripts/myapp.js" type="text/javascript"></script>
</head>
<body ng-app="myapp">
<div ng-controller="HomeController">
<page-tile-grid></page-tile-grid>
</div>
</body>
myapp.js已经
了var myapp= angular.module('myapp', [])
.controller("HomeController", function($scope){......})
.directive('page-tile-grid', function () {....})
.directive('page-tiles', function () {....})
.directive('page-tile-info', function () {....})
我在控制台上看不到任何错误。但是指令中的模板没有加载。并在Batarang Angular控制台上看到此警告:
Module "myapp" was created but never loaded.
答案 0 :(得分:0)
如果您尝试以下内容怎么办?
var app = angular.module('myapp', []);
app.controller('HomeCtrl', function($scope) {
$scope.title = "Homepage";
...
});
app.controller('AboutCtrl', function($scope) {
$scope.title = "About";
...
});