如何正确实例化模块 angular-aria 和 ngmaterial 而不会出现错误?
How to correctly instantiate module angular-aria and ngmaterial without getting the error?
我试图包含 ng-material,起初我收到 'Failed to instantiate module' 错误,然后我还安装了 npm angular-aria,因为这显然是 ng[ 的依赖项=26=] 并在加载 ngmaterial 之前加载它。现在我没有得到同样的错误,不再是 ngmaterial 而是 angular-aria:
ailed to instantiate module angular-aria due to:
Error: [$injector:nomod] Module 'angular-aria' 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.
我觉得我已经阅读了所有类似的内容 post 但没有任何帮助。任何想法将不胜感激!
Ps。如果它对任何事情都很重要,我会使用 gulp。如果 npm 安装和 bower 安装之间有区别,有人可以向我解释吗?
谢谢!
<!DOCTYPE html>
<html lang="en">
<head>
<base href="/" />
<title>Candles Shop</title>
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Josefin+Slab:700" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="//fonts.googleapis.com/css?family=Pacifico" />
<link rel="stylesheet" type="text/css" href="//fonts.googleapis.com/css?family=Rammetto+One" />
<link rel="stylesheet" type="text/css" href="//fonts.googleapis.com/css?family=Gloria+Hallelujah" />
<link rel="stylesheet" type="text/css" href="/font-awesome/css/font-awesome.min.css">
<link rel="stylesheet" href="/materialize-css/bin/materialize.css">
<link rel="stylesheet" type="text/css" href="/angular-input-stars-directive/angular-input-stars.css">
<link rel="stylesheet" type="text/css" href="/style.css" />
<script type="text/javascript" src="/jquery/dist/jquery.min.js"></script>
<script src="/lodash/index.js"></script>
<script src="/angular/angular.js"></script>
<script src="/angular-animate/angular-animate.js"></script>
<script src="/angular-ui-router/release/angular-ui-router.js"></script>
<script src="/angular-ui-router-styles/ui-router-styles.js"></script>
<script src="/angular-ui-bootstrap/ui-bootstrap.js"></script>
<script src="/angular-ui-bootstrap/ui-bootstrap-tpls.js"></script>
<script src="/angulike/angulike.js"></script>
<script src="/angular-password/angular-password.js"></script>
<script type="text/javascript" src="/materialize-css/bin/materialize.js"></script>
<script type="text/javascript" src="/angular-materialize/src/angular-materialize.min.js"></script>
<script type="text/javascript" src="/angular-input-stars-directive/angular-input-stars.js"></script>
<script src="https://js.stripe.com/v2/"></script>
<script type="text/javascript" src="/angular-stripe/release/angular-stripe.js"></script>
<script src="/angular-aria/angular-aria.js"></script>
<script src="/angular-material/angular-material.min.js"></script>
<script type="text/javascript" src="/angular-sidebar/angular-sidebar.css"></script>
<script src="/socket.io-client/socket.io.js"></script>
<script src="/main.js"></script>
</head>
<body ng-app="candleShop" ng-class="{'home-page': $state.includes('home'), 'store-page' : $state.includes('store')}">
<navbar></navbar>
<div id="main" class="container" ui-view autoscroll='true'></div>
</body>
</html>
app.js:
'use strict';
window.app = angular.module('candlesApp', ['ng', 'angulike', 'fsaPreBuilt', 'ngPassword', 'ui.router', 'ui.bootstrap', 'ui.materialize', 'angular-input-stars','angular-stripe', 'ngAnimate', 'angular-aria', 'ngMaterial', 'angular-sidebar']);
如果您在此处查看 angular-aria 的文档:https://docs.angularjs.org/api/ngAria
你会看到这个:
Finally, load the module in your application by adding it as a
dependent module:
angular.module('app', ['ngAria']);
经常出现文件名和模块名不一样的情况。始终检查文档
我试图包含 ng-material,起初我收到 'Failed to instantiate module' 错误,然后我还安装了 npm angular-aria,因为这显然是 ng[ 的依赖项=26=] 并在加载 ngmaterial 之前加载它。现在我没有得到同样的错误,不再是 ngmaterial 而是 angular-aria:
ailed to instantiate module angular-aria due to:
Error: [$injector:nomod] Module 'angular-aria' 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.
我觉得我已经阅读了所有类似的内容 post 但没有任何帮助。任何想法将不胜感激! Ps。如果它对任何事情都很重要,我会使用 gulp。如果 npm 安装和 bower 安装之间有区别,有人可以向我解释吗? 谢谢!
<!DOCTYPE html>
<html lang="en">
<head>
<base href="/" />
<title>Candles Shop</title>
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Josefin+Slab:700" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="//fonts.googleapis.com/css?family=Pacifico" />
<link rel="stylesheet" type="text/css" href="//fonts.googleapis.com/css?family=Rammetto+One" />
<link rel="stylesheet" type="text/css" href="//fonts.googleapis.com/css?family=Gloria+Hallelujah" />
<link rel="stylesheet" type="text/css" href="/font-awesome/css/font-awesome.min.css">
<link rel="stylesheet" href="/materialize-css/bin/materialize.css">
<link rel="stylesheet" type="text/css" href="/angular-input-stars-directive/angular-input-stars.css">
<link rel="stylesheet" type="text/css" href="/style.css" />
<script type="text/javascript" src="/jquery/dist/jquery.min.js"></script>
<script src="/lodash/index.js"></script>
<script src="/angular/angular.js"></script>
<script src="/angular-animate/angular-animate.js"></script>
<script src="/angular-ui-router/release/angular-ui-router.js"></script>
<script src="/angular-ui-router-styles/ui-router-styles.js"></script>
<script src="/angular-ui-bootstrap/ui-bootstrap.js"></script>
<script src="/angular-ui-bootstrap/ui-bootstrap-tpls.js"></script>
<script src="/angulike/angulike.js"></script>
<script src="/angular-password/angular-password.js"></script>
<script type="text/javascript" src="/materialize-css/bin/materialize.js"></script>
<script type="text/javascript" src="/angular-materialize/src/angular-materialize.min.js"></script>
<script type="text/javascript" src="/angular-input-stars-directive/angular-input-stars.js"></script>
<script src="https://js.stripe.com/v2/"></script>
<script type="text/javascript" src="/angular-stripe/release/angular-stripe.js"></script>
<script src="/angular-aria/angular-aria.js"></script>
<script src="/angular-material/angular-material.min.js"></script>
<script type="text/javascript" src="/angular-sidebar/angular-sidebar.css"></script>
<script src="/socket.io-client/socket.io.js"></script>
<script src="/main.js"></script>
</head>
<body ng-app="candleShop" ng-class="{'home-page': $state.includes('home'), 'store-page' : $state.includes('store')}">
<navbar></navbar>
<div id="main" class="container" ui-view autoscroll='true'></div>
</body>
</html>
app.js:
'use strict';
window.app = angular.module('candlesApp', ['ng', 'angulike', 'fsaPreBuilt', 'ngPassword', 'ui.router', 'ui.bootstrap', 'ui.materialize', 'angular-input-stars','angular-stripe', 'ngAnimate', 'angular-aria', 'ngMaterial', 'angular-sidebar']);
如果您在此处查看 angular-aria 的文档:https://docs.angularjs.org/api/ngAria
你会看到这个:
Finally, load the module in your application by adding it as a dependent module:
angular.module('app', ['ngAria']);
经常出现文件名和模块名不一样的情况。始终检查文档