angularjs - Cell template with filter in ng-grid -


i created cell template depends on filter, filter not processed.

the cell defined {field:'status', displayname:'status', celltemplate: 'cell/statuscelltemplate.html'}] template is

<button class="btn btn-primary" ng-click="changestatus(row.getproperty('id'),'{{row.getproperty(col.field) || switchstatus}}')">{{row.getproperty(col.field)}}</button> 

edit

myapp.filter('switchstatus', function() {     return function(input) {         return (input == 'stopped') ? 'started' : 'stopped';     }; }); 

the rendered cell <button class="btn btn-primary ng-scope ng-binding" ng-click="changestatus(row.getproperty('id'),'stopped')">stopped</button>. expect started second parameter.

plunker: when clicking on stopped, current status should started

where data come from? think meant check if input 'stopped' or 'started' this:

app.filter('switchstatus', function() { return function(input) {     var out = "";     if (input == 'stopped') {         out = 'started';     } else if (input == 'started') {         out = 'stopped';     }     console.log(input + " " + out);     return out; }; 

you make filter shorter writing:

app.filter('switchstatus', function() { return function(input) {     return (input == 'stopped') ? 'started' : 'stopped'; }; 

Comments

Popular posts from this blog

java - activate/deactivate sonar maven plugin by profile? -

python - TypeError: can only concatenate tuple (not "float") to tuple -

java - What is the difference between String. and String.this. ? -