hi,
i'm trying to create simple directive, which could be used like this
<select custom-select="types.SOME_TYPE" ng-model="a.SELECT" />
my directive:
m.directive('customSelect', function () {
return {
restrict: 'A',
replace: true,
scope: {
selectModel: '=ngModel',
options: '=customSelect'
},
template: '<div><select eis-control name="selectModel" id="selectModel"\
required ng-model="selectModel" \
ng-options="o.key as o.label for o in options">\
<option style="display:none" value="">Wybierz...</option>\
</select></div>',
compile: function compile(element, attrs) {
return function postLink(scope, iElement, iAttrs) {
};
}
};});
it works fine in angular 1.1.6, but it doesn't work properly in angular
1.2.6/1.2.7 - strange value is being bind to scope variable defined in
ng-model (a.SELECT in this example)
If types.SOME_TYPE is array:
[
{
"key":"KEY_1",
"label":"Label 1"
},
{
"key":"KEY_2",
"label":"Label 2"
}]
then a.SELECT will have these values:
1. for angular 1.1.6 it will be "KEY_1" or "KEY_2" - that's cool
2. for angular 1.2.6/7 it will be "? string:KEY_1 ?" or "? string:KEY_2
?" - that's strange!
Under angular 1.2.6/7 it works fine only if I'm using directive like this:
<some-no-select-tag custom-select="types.SOME_TYPE" ng-model="a.SELECT" />
Here is a demo: Plunker<http://plnkr.co/edit/hlQIoRYHHLzLRCGqVg5o?p=preview>
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/groups/opt_out.