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 an argument.

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

The 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 fine, and here the ng-model is emp.signin. I want to be able to pass this ng-model dynamically as argument

How is this possible?

Aucun commentaire:

Enregistrer un commentaire