angularjs - Trigger a function with ng-click -


So I installed a very simple application to test the ng-click Function:

JS:

  var choreApp = angular.module ('choreApp', []); ChoreApp.controller ('choreCtrl', function ($ scope) {$ scope.logChore = function (home work) {warning (tempo + 'is finished!'}}}) ChoreApp.directive ('child', function () {Return {Christian: 'E', Scope: {done: '& amp;}, Template: "& lt; input type = text ng-model =' core '/> {{chorus}} & lt ; / B & gt; "}});  

html:

  & lt; Div ng-controller = 'choreCtrl' & gt; & Lt; Baby did = 'logchor ()' & gt; & Lt; / Kid & gt; & Lt; Div class = 'button' ng-click = '({chorus: courier})' & gt; Button & lt; / Div & gt; & Lt; / Div & gt;  

However, when I click on .button , nothing happens, there really is nothing, there is no error in the console or anything Why can it be understood?

First you add bootstrap ng-app

   

Then jsfiddle "do not wrap any & lt; head & gt;" Setting

Then the 'done' method that you expect to call, which wraps the log () will not be asked, try adding:

 < Code> choreApp.controller ('choreCtrl', function ($ scope) {$ scope.logChore = function} {Warning (temp + 'is finished!')} $ Scope.done = function () { Warning ('done');}})  

If you create a link function in your instructions and call scope () then Logchor () should be called.


Comments

Popular posts from this blog

winforms - C# Form - Property Change -

java - Messages from .properties file do not display UTF-8 characters -

javascript - amcharts makechart not working -