我是angular js的新手...我只想在单击与HTML相关的链接时加载html文件。但这引发了错误,提示它找不到我的ng-app指令。我编辑了templateUrl对象以加载一些猫的照片……但还是行不通。
[$injector:modulerr] Failed to instantiate module myApp due to:
Error: [$injector:nomod] Module 'myApp' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.
var app = angular.module("myApp", ["ngRoute"]);
app.config(function($routeProvider) {
$routeProvider
.when("/skills", {
templateUrl : "https://proxy.duckduckgo.com/iu/?u=https%3A%2F%2Fkittentoob.com%2Fwp-content%2Fuploads%2F2018%2F01%2FA-fluffy-cat-looking-funny-surprised-or-concerned.jpg&f=1"
})
.when("/interactives", {
templateUrl : "https://proxy.duckduckgo.com/iu/?u=https%3A%2F%2Ftse4.mm.bing.net%2Fth%3Fid%3DOIP.PRniL4_JLNvVMzdVgiDiYgHaEK%26pid%3D15.1&f=1"
});
});
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.7/angular.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.7/angular-route.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.7/angular-resource.js"></script>
<body ng-app="myApp">
<div class="row">
<div class="float-left p-5">
<nav>
<a class="mr-3 menu2" href="#!skills">Skill Set</a>
<a class="mr-3 menu3" href="#!interactives">Interactives</a>
</nav>
</div>
</div>
<div class="h-75">
<div class="middle">
<div ng-view>
<!-- body -->
</div>
</div>
</div>
<script src="script.js"></script>
</body>