ngModel and component with isolated scope
- by Artem Andreev
I am creating simple ui-datetime directive. It splits javascript Date object into _date, _hours and _minutes parts. _date uses jquery ui datepicker, _hours and _minutes - number inputs.
See example: http://jsfiddle.net/andreev_artem/nWsZp/3/
On github: https://github.com/andreev-artem/angular_experiments/tree/master/ui-datetime
As far as I understand - best practice when you create a new component is to use isolated scope.
When I tried to use isolated scope - nothing works. ngModel.$viewValue === undefined.
When I tried to use new scope (my example, not so good variant imho) - ngModel uses value on newly created scope.
Of course I can create directive with isolated scope and work with ngModel value through "=expression" (example). But I think that working with ngModelController is a better practice.
My questions:
Can I use ngModelController with isolated scope?
If it is not possible which solution is better for creating such component?