为什么不插入此指令模板?

时间:2013-07-23 13:06:47

标签: templates angularjs string-interpolation

我错过了什么?

app.directive('summaryAddress', [function () {

    return {
        scope: {
           address: '=summary-address'
        },
        template: "<h2>Billing Address</h2>" +
            "<span>{{address.flatNumber}}</span>"
    };

}]);

输出只是......

  

{{address.flatNumber}}

1 个答案:

答案 0 :(得分:0)

范围映射需要使用属性的规范化驼峰案例名称,而不是标记中显示的格式。

pobo.directive('summaryAddress', [function () {

    return {
        scope: {
            address: '=summaryAddress'
        },
        template: "<h2>Billing Address</h2>" +
            "<span>{{address.flatNumber}}</span>"
    };

}]);