angularjs - How can one UI Bootstrap DatePicker update several controllers? -


I am new to angular JS and I suspect that the answer is to use a factory, but it is beyond my current capacity.

"post-text" itemprop = "text">

Do I have the $ scope in the controller of my codepicker $ watch () And, when the value changes, one can set a $ yolk code and another controller $ rootscope $ watch () that?

Yes, your hump is perfect and this is a clean way that comes to mind: date = date = function (date) {setDate = null; return {getSelectedDate: function () {return selectedDate;}, selected date from the set: function {dateDate = date ;},};})

and in its controllers:

  app.controller ("ctrl1", function ($ scope, date service) { $ Radius $ watch ("dt", function (date) {if (date) {dateService.setselectedDate (date);}}, true);}); app.controller ("ctrl2", function ($ amount, date service) {$ radius. $ clock (dateService.getSelectedDate, function (date) {$ scope.dateFromTheOtherController = date;}, true);});    

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -