Tuesday 15 April 2014

AngularJs module cofiguration using model and provider -



AngularJs module cofiguration using model and provider -

i have application next structure:

definition of model

app.module("example").value("examplemodule", examplemodel)

definition of service provider

app.module("example").provider("exampleservice" , function(){ this.setconfigurationsetting = function (value) { examplemodel.somesetting = value; }; this.$get = function (exampleservice){ homecoming exampleservice; } }

i want configure services using 1 model in app.config function using provider:

app.config("exampleserviceprovider"){ exampleserviceprovider.setconfigurationsetting(true); }

angular documentation says in provider model defined in such way cannot accessed. there suggested way of setting configuration model via provider in such case?

thanks miszy ! you're right! i've added model provider configures private object before injected services model. works great!

angularjs

No comments:

Post a Comment