AngularJS Dependency Compression and Custom Filter Writing

The specific code is shown below:

     
{Name | rhello}}
{{Name | rhello: 3: 5}} // The three parameters are 'INPUT, N1, N2'
{{ Name | RJS}}


VAR App = Angular.Module ("MyApp", ['KK.FILTER']); //kk.filter is to use external filters to rely on injection App.Controller ('FirstController', ['$ SCOPE', FUNCTION) The above line code is compressed on the Controller. The FirstController is used in Controller. ThefirstController is the controller name, and the $ scope must be correct abbreviation. Cannot write free writing, can not be compressed. And Function ($ S), $ S is a compression write method of $ scope *, free Write / $ S.NAME = "Hello AngularJS";}]); app.filter ('rhello' , function () {RETURN FUNCTION (INPUT, N1, N2) {Console.log (Input); console.log (n1); console.log (n2); return input.replace (/ Hello /, "Hello") }});
/ / External introduction filter for use var appfilter = angular.Module ("kk.filter", []); // The kk.filter here is a dependency name Can be casually. And the name of the var appfilter is also just appfilter.filter ('rjs', function () {// filter name casual RETURN FUNCTION (Input, N1, N2) {Console.log (INPUT); console.log (N1) Console.log (N2); Return INPUT.REPLACE (/ JS /, "JavaScript"); // This is implemented to change JS to JavaScript (string)}});
The above is the AngularJS dependency compression and custom filter written to you. I hope that everyone can help, if you have any questions, please leave a message, the small package will reply to everyone. of. Thank you very much for your support of Tumi Cloud Website!
                     
© Copyright Notice
THE END
Just support it if you like
like0
share
comment Grab the couch

Please log in to comment