0

プランカー: http://plnkr.co/edit/XBJjr6uR1rMAg3Ng7DiJ?p=preview

これら2つは同じように見えると思います:

<span dt-attrib="{{person.name}}">This won't be here</span><br/>
<span class="dt-class: {{person.name}};">This won't be here.</span> - this does not process

しかし、これは私が得るものです:

This text was set by the dtAttrib directive, value="Burt Finklestein"
This text was set by the dtClass directive, value="{{person.name}}"

コード:

app.directive("dtAttrib", function() {
    return {
        restrict: "A",
        link: function(scope, element, attrs) {
            element.text('This text was set by the dtAttrib directive' + DisplayValueString(attrs.dtAttrib));
            }
        }
    }
});

app.directive("dtClass", function() {
    return {
        restrict: "C",
        link: function(scope, element, attrs) {
            element.text('This text was set by the dtClass directive' + DisplayValueString(attrs.dtClass));
        }
    };
});
4

1 に答える 1