mardi 4 août 2015

Pass ng-model as argument in directive angualjrs

I am writing a directive in angularjs and I want to pass ng-model as argument.

<div class="col-md-7"><time-picker></time-picker></div>

Directive is ,

    app.directive('timePicker', function () {
    return {
        restrict: 'E',
        replace: true,
        template: '<input type="text" class="form-control time-picker" ng-model="emp.signin">',
        link: function ($scope, element, form) {
            $(element).timepicker({'timeFormat': 'H:i:s'});
        }
    }
})

It is working find, and here ng-model is emp.signin and I put this directly. I want able to pass this ng-model dynamically as argument

how it is possible?

Aucun commentaire:

Enregistrer un commentaire