-2
라이프 사이클 이후에 메소드를 실행하려면, 예를 들어 : cufon으로 사용되는 변경 글꼴. 버튼을 클릭하고 ng-click = "addHandler()"문을 호출하고 싶습니다. Cufon.replace ('h1', {onBeforeReplace : Bifon.convert}); 전화 했어? 해결 방법을 찾으십니까?라이프 사이클 후의 메소드 실행
angular.module('myApp', [])
.directive('replaceStyle', function() {
return function(scope, element, attrs) {
element.ready(function(){
element.html(element.html().replace('h1', { onBeforeReplace: Bifon.convert }))
})
};
});
그리고 당신의 마크 업 :
$scope.text = "این یک تست است";
$scope.AddHandler = function() {
$scope.text = "تست تست";
Cufon.replace('h1', { onBeforeReplace: Bifon.convert });
};
<h1> {{text}}</h1>
<button ng-click="AddHandler()">Add</button>