gpt4 book ai didi

javascript - 尝试使用 ngMaterial 但我得到 $injector :modulerr error

转载 作者:行者123 更新时间:2023-11-30 15:56:43 27 4
gpt4 key购买 nike

我今天开始使用 Angular Material ,但是当我想在我的项目中使用 ngMaterial 时,我得到了 an error ...

我尝试在本地使用 Angular Material ,我的意图很简单:使用 <md-button> :

<div ng-app="MyApp" class="buttondemoBasicUsage" ng-controller="AppCtrl" ng-cloak="">
<md-content>

<section layout="row" layout-sm="column" layout-align="center center" layout-wrap="">
<md-button>{{title1}}</md-button>
<md-button md-no-ink="" class="md-primary">Primary (md-noink)</md-button>
<md-button ng-disabled="true" class="md-primary">Disabled</md-button>
<md-button class="md-warn">{{title4}}</md-button>
<div class="label">Flat</div>
</section>
</md-content>
</div>

我添加了我怀疑可以解决我的问题的每个脚本,如下所示:

<script type="text/javascript" src="/desktopmodules/Barrizon/Scripts/Angular1.x/angular.min.js"></script>
<script type="text/javascript" src="/desktopmodules/Barrizon/Scripts/Material/angular-animate.min.js"></script>
<script type="text/javascript" src="/desktopmodules/Barrizon/Scripts/Material/angular-messages.min.js"></script>
<script type="text/javascript" src="/desktopmodules/Barrizon/Scripts/Material/angular-aria.min.js"></script>
<script type="text/javascript" src="/desktopmodules/Barrizon/Scripts/Material/angular-material.min.js"></script>
<script type="text/javascript" src="/DesktopModules/mvc/Barrizon/LArticle/List/Resources/JS/Barrizon.LArticle.Settings.js"></script>

最后一个 js ( Barrizon.LArticle.Settings.js ) 是我在那里写的自定义 js:

angular.module('MyApp', ['ngAria', 'ngMessages', 'ngMaterial', 'material.svgAssetsCache'])

.controller('AppCtrl', function ($scope) {
$scope.title1 = 'Button';
$scope.title4 = 'Warn';
$scope.isDisabled = true;

$scope.googleUrl = 'http://google.com';

});

有谁知道我该如何解决这个错误?

非常感谢

最佳答案

您需要将所有这些脚本连同您的自定义 js 添加到您的代码中,

<script data-require="angular.js@1.4.x" src="https://code.angularjs.org/1.4.9/angular.js" data-semver="1.4.9"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.5.7/angular-messages.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular-animate.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular-material/1.0.9/angular-material.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.5.7/angular-aria.js"></script>
<script src="http://ngmaterial.assets.s3.amazonaws.com/svg-assets-cache.js"></script>

笨蛋:http://plnkr.co/edit/ZWUIiLRaJOvC5WMrMZQq?p=preview

关于javascript - 尝试使用 ngMaterial 但我得到 $injector :modulerr error,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38411638/

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