﻿<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	
	>
<channel>
	<title>《Day 2: AngularJS —— 对AngularJS的初步认识》的评论</title>
	<atom:link href="http://www.zhoujingen.cn/blog/7438.html/feed" rel="self" type="application/rss+xml" />
	<link>http://www.zhoujingen.cn/blog/7438.html</link>
	<description>平衡、快乐、高效，成为一个有自我、有目标、有结果的敏捷个人。</description>
	<lastBuildDate>Sat, 28 Mar 2026 08:39:41 +0000</lastBuildDate>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.7.1</generator>
	<item>
		<title>作者：吴新星</title>
		<link>http://www.zhoujingen.cn/blog/7438.html/comment-page-1#comment-3771</link>
		<dc:creator><![CDATA[吴新星]]></dc:creator>
		<pubDate>Tue, 04 Aug 2015 14:58:48 +0000</pubDate>
		<guid isPermaLink="false">http://www.zhoujingen.cn/blog/?p=7438#comment-3771</guid>
		<description><![CDATA[使用app.js做数据初始化时，代码不能运行，报  Argument &#039;BookCtrl&#039; is not a function, got undefined ；

似乎是controller的写法过期了，app.js用以下写法能跑通：
angular.module(&#039;bookShop&#039;,[ ])
       .controller(&#039;BookCtrl&#039;,function($scope){
            $scope.books=[
                    {&#039;name&#039;:&#039;Effective Java&#039;, &#039;author&#039;:&#039;Joshua Bloch&#039;},
                    {&#039;name&#039;:&#039;Year without Pants&#039;, &#039;author&#039;:&#039;Scott Berkun&#039;},
                    {&#039;name&#039;:&#039;Confessions of public speaker&#039;,&#039;author&#039;:&#039;Scott Berkun&#039;},
                    {&#039;name&#039;:&#039;JavaScript Good Parts&#039;,&#039;author&#039;:&#039;Douglas Crockford&#039;}
            ]
       });

其中 bookShop 为 ng-app的值，即需要将index.html中的
改成 。]]></description>
		<content:encoded><![CDATA[<p>使用app.js做数据初始化时，代码不能运行，报  Argument &#8216;BookCtrl&#8217; is not a function, got undefined ；</p>
<p>似乎是controller的写法过期了，app.js用以下写法能跑通：<br />
angular.module(&#8216;bookShop&#8217;,[ ])<br />
       .controller(&#8216;BookCtrl&#8217;,function($scope){<br />
            $scope.books=[<br />
                    {'name':'Effective Java', 'author':'Joshua Bloch'},<br />
                    {'name':'Year without Pants', 'author':'Scott Berkun'},<br />
                    {'name':'Confessions of public speaker','author':'Scott Berkun'},<br />
                    {'name':'JavaScript Good Parts','author':'Douglas Crockford'}<br />
            ]<br />
       });</p>
<p>其中 bookShop 为 ng-app的值，即需要将index.html中的<br />
改成 。</p>
]]></content:encoded>
	</item>
</channel>
</rss>
