This works for me:

.directive('mySelect', [  
  '$timeout'
  ($timeout) ->
    restrict: 'E'
    templateUrl: '/shared/select.html'
    replace: yes
    scope:
      ngModel: '='
      ngChange: '&'
      nameProp: '='
      options: '='
    link: (scope, element, attrs) ->
      scope.$watch 'ngModel', ->
        scope.selected = scope.ngModel?[scope.nameProp]
      scope.select = (option) ->
        scope.ngModel = option
        $timeout ->
          $scope.ngChange()
])

Am Montag, 22. April 2013 01:26:56 UTC+2 schrieb Lucas Antoine:
>
> This solution doesn't work for me.
>
> On Sunday, 27 January 2013 16:07:26 UTC+8, Mahbub wrote:
>>
>> Hi,
>>
>> I was wondering how to implement a dropdown directive which will have the 
>> ngChange event like a normal select has. 
>>
>> This is what i have so far http://jsfiddle.net/mahbub/GfCTU/19/ . I know 
>> ngChange requires ngModel controller but how do i trigger the onChange on 
>> that dropdown when value changes. 
>>
>> Any help is greatly appreciated. 
>>
>> Thanks
>>
>

-- 
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/d/optout.

Reply via email to