द्वारा निर्धारित किया जाता कृपया इस Plunkerनिर्देशक के टेम्पलेट मूल्य नहीं मिलता है कि संकलन
मैं एक HTML कस्टम कोणीय निर्देश
<body ng-controller="myCtrl">
<h1>Hello Plunker!</h1>
<div><sample attributeone="Sample Attribute"></sample></div>
</body>
का उपयोग करता है और मेरे निर्देश इस तरह दिखता है:
myApp.directive('sample', function() {
var value = "";
return {
replace: true,
restrict: 'E',
scope : false,
template: '<div>This is a sample Paragraph '+ value + '</div>',
compile: function (tElement, tAttributes) {
return {
pre: function preLink(scope, element, attributes) {
console.log(attributes.log + ' (pre-link)' );
value = tAttributes.attributeone;
}
};
}
};
});
मेरी राय में, pre
compile
को बोफोरे निष्पादित करना चाहिए टेम्पलेट लौटाया गया है और value
shou एलडी "Sample Attribute"
पर सेट किया जाना चाहिए। लेकिन इसका मूल्यांकन नहीं हो रहा है।
अपेक्षित आउटपुट
This is a sample Paragraph Sample Attribute
वास्तविक उत्पादन
This is a sample Paragraph
वहाँ किसी भी अन्य तरीके जिसके माध्यम से मैं टेम्पलेट में value
सेट है?