第一次练习就直接没效果:
"后不能直接以 function XXXcontroller (){ code......}这样的方式直接注册监听器了。
以后必须angular.module('phonecatApp', []).controller('PhoneListCtrl',function($scope) {}这样来将controller注册到对应的模型上。"
以下是标准的:
-
<script type="text/javascript">
-
angular.module('phonecatApp', []).controller('PhoneListCtrl', function ($scope) {
-
$scope.phones = [
-
{
-
"name": "Nexus S",
-
"snippet": "Fast just got faster with Nexus S."
-
},
-
{
-
"name": "Motorola XOOM? with Wi-Fi",
-
"snippet": "The Next, Next Generation tablet."
-
},
-
{
-
"name": "MOTOROLA XOOM?",
-
"snippet": "The Next, Next Generation tablet."
-
}
-
];
-
});
-
-
</script>
国内中文博客还不更新,情何以堪。。。。
另外,Angularjs文档被墙在外面了。。
参考:
http://jingyan.baidu.com/article/eae07827ae12b91fec548597.html