1
角控制器無法與index.html連接,項目使用安裝了node.js的http-server運行。無法運行angularjs文件控制器錯誤
classifieds.js
`(function() {
"use strict";
angular
.module("ngClassifieds")
.controller("ClassifiedsCtrl", ['$scope', function($scope) {
$scope.name ={text: 'Asif'};
};
}]();`
的index.html
`<!DOCTYPE html>
<html>
<head>
<title>ngClassifieds</title>
</head>
<body ng-app="ngClassfieds" ng-controller="ClassifiedsCtrl">
<input type="text" placeholder="Whats your name" ng-model="name" >
<h1>{{greeting.text}}</h1>
<script src="node_modules/angular/angular.min.js"> </script>
<script src="scripts/app.js"></script>
<script src="components/classifieds.js"></script>
</body>
</html>`
做出 'ngClassifieds' 模塊的使用,棱角分明。模塊(「ngClassifieds」,[]).. – Ajay