AngularJS Two-way Data Binding in Nested Directives

前端 未结 3 1001
北海茫月
北海茫月 2021-02-20 05:50

Please let me know if you need more information or want me to clarify anything. I have tried a lot of different things to figure this out but haven\'t found a solution.

3条回答
  •  不思量自难忘°
    2021-02-20 06:47

    I'm sorry for the previous code. Try this instead: http://jsfiddle.net/CxNc2/2/

    Instead of passing the actual value, I'm now passing the object + a pointer to the correct value inside. I added 'refobject' here:

    
        

    and I added refobj + value here:

    app.directive('formrow', function() {
        return {
            scope: {
                label: "@label",
                type: "@type",
                value: "@value",
                refobj: "="
            },
            replace: true,
            template: '
    ' + '
    {{label}}
    ' + '
    ' + '' + '
    ' + '
    ' }

提交回复
热议问题