In single page i am using *two controls* and i have used *' 
angular-multi-select' *my custom directive for applying *multiselect plugin*. 
But when i load page every time i am getting only once control i.e 
*ddlMultiSelect2* with in my angular custom directive *link function*. Can 
any one help on this. Thanks in advance.

Mark Up :
 <form class="form-horizontal">
                   
                    <div class="form-group">
                        <label for="exampleInputPassword1">Multi Select : 
</label>
                        <select id="ddlMultiSelect1" ng-required="true" 
 angular-multi-select options="EmployeeList1" ng-options="emp.EmployeeName 
for emp in EmployeeList1 track by emp.EmployeeId " class="form-control" 
ng-model="testmodel" multiple="multiple"></select>
                    </div>
                    
                    
                     <div class="form-group">
                        <label for="exampleInputPassword1">Multi Select 2: 
</label>
                        <select class="form-control" id="ddlMultiSelect2" 
 ng-required="true" options="EmployeeList2" angular-multi-select 
 ng-model="test" multiple="multiple" ng-options="emp.EmployeeName for emp 
in EmployeeList2 track by emp.EmployeeId ">
                            <option>Select people</option>
                        </select>
                    </div>

                </form>

Angular Js Directive :

app.directive('angularMultiSelect', function ($parse, $timeout) {

        return {
            restrict: 'A',
            link: function (scope, element, attrs) {
///////////        Here i am getting ddlMultiSelect2 as element every time 
directive considering only once control i.e ddlMultiSelect2 even though we 
have different controls 

                var modelAccessor = $parse(attrs.options);
                scope.$watch(modelAccessor, function (val) {
                 

                    applymultiselect();
                 
                });
                $(element).multiselect();
                applymultiselect = function () {
                    debugger;
                    $(element).multiselect('rebuild');
                }
            }
        };

-- 
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