在查看了一些参考资料之后,我对 我需要在我的新Angular Material项目中包含 where 感到有些困惑。
以下是相关文件:
MainController.js
/**
* Created by jkl94 on 5/11/2017.
*/
var RhetoricChecker = angular.module('RhetoricChecker.controllers', ['ngMaterial']);
RhetoricChecker.controller('MainCtrl', function($scope, $timeout, $mdSidenav, $log){
});
main.html中
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<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/angular-material.min.css">
<title>Welcome to RhetoricChecker!</title>
</head>
<body>
<div ng-controller="MainCtrl" layout="column" style="height:500px;" ng-cloak>
<section layout="row">
<md-sidenav class="md-sidenav-left" md-component-id="left" md-is-locked-open="$mdMedia('gt-md)" md-whiteframe="4">
<md-toolbar class="md-theme-indigo">
<h1 class="md-toolbar-tools">Sidenav Left</h1>
</md-toolbar>
</md-sidenav>
</section>
<h1>Welcome to RhetoricChecker!</h1>
<!-- HTML STUFF -->
</div>
<!-- Angular Material requires Angular.js Libraries -->
<script src="./node_modules/angular/angular.min.js"></script>
<script src="./node_modules/angular-animate/angular-animate.min.js"></script>
<script src="./node_modules/angular-aria/angular-aria.min.js"></script>
<script src="./node_modules/angular-messages/angular-messages.min.js"></script>
<!-- Angular Material Library -->
<script src="./node_modules/angular-material/angular-material.min.js"></script>
<script src="./controllers/MainController.js"></script>
<!-- Your application bootstrap -->
<script type="text/javascript">
/**
* You must include the dependency on 'ngMaterial'
*/
angular.module('RhetoricChecker.controllers', ['ngMaterial']);
</script>
</body>
</html>
server.js
/**
* Created by jkl94 on 5/11/2017.
*/
var express = require('express');
var app = express();
var routes = require('./routes');
routes(app);
app.listen(1337);
console.log("Now listening on port 1337");
我认为这只是我没有在正确的位置导入正确的文件的问题,但对于我的生活,我无法弄清楚我错过了什么。
答案 0 :(得分:0)
我只需将我的所有导入切换为CDN即可解决此问题。另外,我使用express通过静态文件路由来改变我的MainController的位置。