javascript - How about assign function from service in controller -


how assign function instead of create new function in controller in angularjs? why do?, why don't?

to this:

//controller example function examplectrl(customservice) {     var example = this;     example.doany = customservice.doany; } 

instead of this:

//controller example function examplectrl(customservice) {     var example = this;     example.doany = doany;      function doany() {         customservice.doany();     } } 

i doubtful becouse of this: https://material.angularjs.org/latest/demo/dialog take of dialogcontroller in js tab.

many thanks.


Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -