繁体   English   中英

角材质导航栏未渲染

[英]Angular material nav-bar is not rendering

我正在尝试使用角度材料设计,目前正在从事导航工作。 我在官方网站上尝试了这些示例,但导航栏未渲染。 我也尝试搜索解决方案,但是没有一个帮助。 这是代码:

 <html lang="en">
<head>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/angular_material/1.1.0-rc2/angular-material.min.css">
</head>
<body ng-app="MyApp" ng-cloak>    
    <div ng-controller="AppCtrl" ng-cloak="" class="navBardemoBasicUsage">
        <md-content class="md-padding">
            <md-nav-bar md-selected-nav-item="currentNavItem" nav-bar-aria-label="navigation links">
                <md-nav-item md-nav-click="goto('page1')" name="page1">Page One</md-nav-item>
                <md-nav-item md-nav-click="goto('page2')" name="page2">Page Two</md-nav-item>
                <md-nav-item md-nav-click="goto('page3')" name="page3">Page Three</md-nav-item>
            </md-nav-bar>
        <span>{{currentNavItem}}</span>
        </md-content>
    </div>

    <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.5.3/angular.min.js"></script>
    <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.5.3/angular-animate.min.js"></script>
    <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.5.3/angular-aria.min.js"></script>
    <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.5.3/angular-messages.min.js"></script>
    <script src="http://ajax.googleapis.com/ajax/libs/angular_material/1.1.0-rc2/angular-material.min.js"></script>

    <script type="text/javascript">    
        (function() {
            'use strict';

            angular.module('MyApp',['ngMaterial', 'ngMessages'])
                .controller('AppCtrl', AppCtrl);

            function AppCtrl($scope) {
                $scope.currentNavItem = 'page1';
            }
        })();
    </script>
</body>
</html>

有人知道此代码有什么问题吗?

您正在加载的Angular Material文件似乎由于某些原因而无法使用。 更新它们确实有效。

<html lang="en">
<head>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/angular_material/1.1.0-rc5/angular-material.min.css">
</head>
<body ng-app="MyApp" ng-cloak>    
    <div ng-controller="AppCtrl" ng-cloak="" class="navBardemoBasicUsage">
        <md-content class="md-padding">
            <md-nav-bar md-selected-nav-item="currentNavItem" nav-bar-aria-label="navigation links">
                <md-nav-item md-nav-click="goto('page1')" name="page1">Page One</md-nav-item>
                <md-nav-item md-nav-click="goto('page2')" name="page2">Page Two</md-nav-item>
                <md-nav-item md-nav-click="goto('page3')" name="page3">Page Three</md-nav-item>
            </md-nav-bar>
        <span>{{currentNavItem}}</span>
        </md-content>
    </div>

    <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.5.5/angular.min.js"></script>
    <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.5.5/angular-animate.min.js"></script>
    <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.5.5/angular-aria.min.js"></script>
    <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.5.5/angular-messages.min.js"></script>
    <script src="http://ajax.googleapis.com/ajax/libs/angular_material/1.1.0-rc5/angular-material.min.js"></script>

    <script type="text/javascript">    
        (function() {
            'use strict';

            angular.module('MyApp',['ngMaterial', 'ngMessages'])
                .controller('AppCtrl', AppCtrl);

            function AppCtrl($scope) {
                $scope.currentNavItem = 'page1';
            }
        })();
    </script>
</body>
</html>
<script src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/t-114/svg-assets-cache.js"></script>

添加此脚本

在这里,我有一个链接http://codepen.io/team/MHENewTech/pres/LZpzwX

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM