Updating ng-model within a directive that uses a template

后端 未结 2 1362
栀梦
栀梦 2021-01-01 21:40

I have a directive that is instantiated like this:


Inside the directive, the datepic

2条回答
  •  难免孤独
    2021-01-01 22:19

    Depending on how complicated your passthrough is, you can just use the = scope to do a bidirectional bind between a local name and ngModel, like in this fiddle:

    http://jsfiddle.net/mThrT/22/

    I had a hell of a time setting up the fiddle for some reason (first time trying with angular) but here's the money shot:

    template: '
    ' + '' + '' + '
    ', scope: { bar: '=ngModel' },

提交回复
热议问题