gpt4 book ai didi

angularjs - 将 ngRoute 添加到 angularjs

转载 作者:行者123 更新时间:2023-12-02 23:35:22 25 4
gpt4 key购买 nike

我正在使用 angularjs 和 yeoman。我正在尝试将 ngRoute 添加到我的项目中。我已经用 Bower 安装了它

"angular-route": "~1.4.1",

当我尝试将其加载到 app.js 中时,出现此错误

angular.module('myApp', ['ngAnimate', 'ngCookies', 'ngResource', 'ui.router', 'ngSanitize', 'ngTouch','ngRoute'])

Error: [$injector:modulerr] Failed to instantiate module myApp due to: [$injector:modulerr] Failed to instantiate module ngRoute due to: [$injector:nomod] Module 'ngRoute' 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.

最佳答案

您需要引用angular-route.js,请找到cdn链接如下

<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.5/angular.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.5/angular-route.min.js"></script>

您还可以在以下链接中获取 Angular 的最新版本 CDN http://cdnjs.com/libraries/angular.js/1.4.0

关于angularjs - 将 ngRoute 添加到 angularjs,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30895195/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com