我的代码的哪一部分是错误的??如果它有很多错误,请不要给我 UNLIKE :D 我在 Angularjs 中很新
<script>
demoapp = angular.module('demoapp', []);
demoapp.factory('simplefactory', function ($scope) {
//var customers = [{ name: 'Alireza', family: 'massali' }, { name: 'Ehsan', family: 'abdolahi' }, { name: 'Ali', family: 'Shirvanian'}];
var customers ="3576324";
//var factory = {};
this.GetCust = function () {
return customers;
};
this.PostCust = function (customer) {
return customers;
};
return factory;
});
var xxx = angular.module('mmodule', []);
var conts = {}
conts.simple = function ($scope, simplefactory) {
$scope.name = simplefactory.GetCust();
}
conts.simple1 = function ($scope) {
$scope.name1 = "2222";
}
xxx.controller(conts);
这是HTML
<div ng-app='mmodule'>
<p ng-controller='simple'>{{name}}</p></div>