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.
Do I have the Yes, your hump is perfect and this is a clean way that comes to mind: and in its controllers: $ 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?
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
Post a Comment