javascript - AngularJS Custom Directive shows {{obj}} but not {{obj.prop}}? -
i'm trying build simple angular directive:
app.directive("mydirective", function () { return { template: "{{result}} {{result.starttime}}", scope: { result: '@result' } }; });
and use way in view:
<div my-directive result="{{result}}"></div>
the problem {{result}}
displayed correctly (as json) abject, while {{result.starttime}}
not displayed, despite fact displayed {{result}}
contains starttime
property.
2 problems:
1 need pass model in, not interpolated string.
<div my-directive result="result"></div>
2 need assign value directive, use '=' instead of '@' gives 1-way binding directive dom only.
app.directive("mydirective", function () { return { template: "{{result}}, {{result.starttime}}", scope: { result: '=' } }; });
Comments
Post a Comment