gpt4 book ai didi

javascript - Angular-Materials 介绍无法正常工作或无法正确渲染

转载 作者:行者123 更新时间:2023-11-30 00:07:21 27 4
gpt4 key购买 nike

所以我将在 Angular Materials 网站上进行介绍 here .据我所知,我正在按照信中的指示进行操作。

更多地查看堆栈溢出和谷歌似乎表明 CND 链接是错误的,但我得到了相同的结果。我会发布一个链接,但我是新来的。

我没有收到任何错误并且使用的是 Visual Studio 2015

在 Chrome 中打开页面并调出开发工具时,我得到了这个: Errors when inspecting from Chrome

我还尝试从 npm 和 bower 安装它们并相应地更改链接无济于事。

我会发布一个 plunker,但我还是新手。

这是我的代码 Angular 代码:

<!DOCTYPE html>
<html ng-app="ReconciliationWebApp">
<head>
<!-- Angular Material style sheet -->
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/angular_material/0.11.2/angular-material.min.css">
</head>
<body ng-controller="MainCtrl">
<!--Content-->
<md-toolbar>
<div class="md-toolbar-tools">
<h2>Reconciliation Forms</h2>
</div>
</md-toolbar>
<md-content>
<div layout="row" layout-align="center start">
<div layout-fill>
<md-card>
<md-card-title>
<md-card-title-text>
<span class="md-headline">Hello!</span>
</md-card-title-text>
</md-card-title>
<md-card-content>
<p>
Whatever you do, do not click the button below.
</p>
</md-card-content>
<md-card-actions layout="row" layout-align="start">
<md-button ng-click="releaseKraken()" class="md-primary md-raised">I Dare You!</md-button>
</md-card-actions>
</md-card>
</div>
</div>
</md-content>

<!-- Angular Material Dependencies -->
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js"> </script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular-animate.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular-aria.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular-messages.min.js"></script>

<!-- Angular Material Library -->
<script src="https://ajax.googleapis.com/ajax/libs/angular_material/0.11.2/angular-material.min.js"></script>
<script src="../../Scripts/Tabs.js" charset="utf-8"></script>
<!-- Your application bootstrap -->
<script type="text/javascript">
angular.module('ReconciliationWebApp', ['ngMaterial']);
</script>
</body>
</html>

这是我的 Javascript:

angular.module('ReconciliationWebApp', ['ngMaterial'])
.controller('MainCtrl', function ($scope, $mdDialog) {
$scope.hello = 'Hello Angular Material';

$scope.releaseKraken = function () {
$mdDialog.show(
$mdDialog.alert({
title: 'Danger',
textContent: 'You asked for it!',
ok: 'Run!'
})
);
}
})
;

谁能告诉我我做错了什么?

我希望我已经充分解释了自己,但如果我能提供任何其他可能有帮助的东西,请告诉我!

最佳答案

如果您在其他位置使用脚本文件,则需要在索引页中添加对该文件的引用。您的代码完全可以正常工作。这是工作的plunker:http://plnkr.co/edit/Ux1pOFgvQgipMqzvfs9X?p=preview

<!DOCTYPE html>
<html ng-app="ReconciliationWebApp">
<head>
<!-- Angular Material style sheet -->
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/angular_material/0.11.2/angular-material.min.css">
</head>
<body ng-controller="MainCtrl">
<!--Content-->
<md-toolbar>
<div class="md-toolbar-tools">
<h2>Reconciliation Forms</h2>
</div>
</md-toolbar>
<md-content>
<div layout="row" layout-align="center start">
<div layout-fill>
<md-card>
<md-card-title>
<md-card-title-text>
<span class="md-headline">Hello!</span>
</md-card-title-text>
</md-card-title>
<md-card-content>
<p>
Whatever you do, do not click the button below.
</p>
</md-card-content>
<md-card-actions layout="row" layout-align="start">
<md-button ng-click="releaseKraken()" class="md-primary md-raised">I Dare You!</md-button>
</md-card-actions>
</md-card>
</div>
</div>
</md-content>

<!-- Angular Material Dependencies -->
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js"> </script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular-animate.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular-aria.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular-messages.min.js"></script>

<!-- Angular Material Library -->
<script src="https://ajax.googleapis.com/ajax/libs/angular_material/0.11.2/angular-material.min.js"></script>
<script src="../../Scripts/Tabs.js" charset="utf-8"></script>
<!-- Your application bootstrap -->
<script type="text/javascript">
angular.module('ReconciliationWebApp', ['ngMaterial'])
.controller('MainCtrl', function ($scope, $mdDialog) {
$scope.hello = 'Hello Angular Material';

$scope.releaseKraken = function () {
$mdDialog.show(
$mdDialog.alert({
title: 'Danger',
textContent: 'You asked for it!',
ok: 'Run!'
})
);
}
})
;
</script>
</body>
</html>

关于javascript - Angular-Materials 介绍无法正常工作或无法正确渲染,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38006044/

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