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

python - Writing Greek in matplotlib labels, titles -

c# - LINQ to Entities does not recognize the method 'Int32 IndexOf(System.String, System.StringComparison)' method -

Pygame memory leak with transform.flip -