按钮单击不起作用

时间:2013-10-21 08:40:13

标签: angularjs angularjs-directive

从AngularJS教程egghead.io中获取了它,它似乎永远不会出现在logchore函数中:

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

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

1 个答案:

答案 0 :(得分:2)

将ngclick =“done()”替换为ng-click =“done()”

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

取自小提琴