我写了一个简单的工厂服务。这里是小提琴的链接 http://jsfiddle.net/#&togetherjs=caUQB0merH 我无法确定小提琴为什么不起作用。谁能指出问题
提前致谢
更新: -
<script>
var StudentModule=angular.module("StudentModule",[]);
function factoryfuc()
{
return[
{name:"maclean", age:"22"},
{name:"sachin", age:"25"}
];
}
StudentModule.factory('Studentfactory',factoryfuc);
function StudentController($scope,Studentfactory)
{
$scope.students=Studentfactory;
}
</script>
<div ng-app="StudenModule" ng-controller="StudentController">
<table ng-repeat="student in students"><tr><td>{{student.name}}</td><td>{{student.age}}</td></tr></table>
</div>