0

从 AngularJS 教程egghead.io中获取这个,它似乎从来没有命中 logchore 函数:

app.controller("ChoreCtrl", function($scope) {
        $scope.logChore = function() {
            alert("is done");
        }
})

jsfiddle:http: //jsfiddle.net/dingen2010/sFnAr/1/

4

1 回答 1

2

只需将 ngclick="done()" 替换为 ng-click="done()"

            template: '<input type="text" ng-model="chore">' + ' {{chore}}' + ' <div class="button" ng-click="done()">i m done</div>'

取自小提琴

于 2013-10-21T08:45:42.090 回答