angularjs - My filter does not work -
I'm trying to change my position value from number to 'text'
I wonder Is that how I can solve this, and what did I do wrong? Thank you in advance
& lt; Table & gt; & Lt; Tr ng-repeat = "x in id" & gt; & Lt; Td> {{X.id}} & lt; / Td> & Lt; Td> {{X.status | | Status}} & lt; / TD & gt; & Lt; / TR & gt; & Lt; / Table & gt; when I write. Status & lt; - It crashes the whole ng recurrence and does not show anything.
var app = angular Modules ('Customer Controller', []); Customers controller of function ($ radius, $ http) {$ http.get ("localhost"). Civet (function (feedback) {$ scope.Id = response;}); App.filter ('position', function) (return work) {var statu; switch (input) {case 10: statu = 'bronze'; brakes; case 20: statu = 'silver'; pause; case 30: Statu = 'gold'; break; case 40: statu = 'elite'; break;} return statu;};});
You are defining a filter inside a controller. This is not valid. You can add filters to only one module during the configuration phase, before the app starts and the administrator can be given instantaneously. Code should be:
var app = angular Modules ('Customer Controller', []); App.filter ('position', function) (return work) {var statu; switch (input) {case 10: statu = 'bronze'; brakes; case 20: statu = 'silver'; pause; case 30: Statu = 'gold'; break; case 40: statu = 'elite'; break;} return statu;};}); App.controller ('customersController', function ($ radius, $ http) {$ http.get ("localhost"). Civet (function) {$ scope.Id = response;}}}};
Comments
Post a Comment