@@ -177,18 +177,23 @@ var ngBindTemplateDirective = ['$interpolate', function($interpolate) {
177
177
</example>
178
178
*/
179
179
var ngBindHtmlDirective = [ '$sce' , '$parse' , function ( $sce , $parse ) {
180
- return function ( scope , element , attr ) {
181
- element . addClass ( 'ng-binding' ) . data ( '$binding' , attr . ngBindHtml ) ;
180
+ return {
181
+ compile : function ( tElement , tAttrs ) {
182
+ tElement . addClass ( 'ng-binding' ) ;
182
183
183
- var parsed = $parse ( attr . ngBindHtml ) ;
184
- var changeDetector = $parse ( attr . ngBindHtml , function getStringValue ( value ) {
184
+ return function ( scope , element , attr ) {
185
+ element . data ( '$binding' , attr . ngBindHtml ) ;
186
+ var parsed = $parse ( attr . ngBindHtml ) ;
187
+ var changeDetector = $parse ( attr . ngBindHtml , function getStringValue ( value ) {
185
188
return ( value || '' ) . toString ( ) ;
186
189
} ) ;
187
190
188
- scope . $watch ( changeDetector , function ngBindHtmlWatchAction ( ) {
189
- // we re-evaluate the expr because we want a TrustedValueHolderType
190
- // for $sce, not a string
191
- element . html ( $sce . getTrustedHtml ( parsed ( scope ) ) || '' ) ;
192
- } ) ;
193
- } ;
191
+ scope . $watch ( changeDetector , function ngBindHtmlWatchAction ( ) {
192
+ // we re-evaluate the expr because we want a TrustedValueHolderType
193
+ // for $sce, not a string
194
+ element . html ( $sce . getTrustedHtml ( parsed ( scope ) ) || '' ) ;
195
+ } ) ;
196
+ } ;
197
+ }
198
+ }
194
199
} ] ;
0 commit comments