2014-09-04 2 views
0

TypeKit에서 글꼴을 적용하기 전에 지시문이 실행되기 때문에 위치가 올바르지 않습니다.TypeKit이 글꼴을로드 한 후 AngularJS 지시문을 실행하십시오.

app.directive('myDirective', function(){ 
    return { 
     restrict: 'A', 
     link: function(scope, elem, attrs){ 

      var active = elem.children('li.active'); 
      console.log(active[0].offsetLeft); // <-- This is wrong 

      elem.bind('click', function(){ 
       var active = elem.children('li.active'); 
       console.log(active[0].offsetLeft); // <-- This is correct 
      }); 
     } 
    }; 
}); 

글꼴을로드 한 후 지시문을 가져 오는 방법에 대한 아이디어가 있습니까?

답변

0

실제로 저는 골치 거리입니다. 로컬로 작업 할 때만 실패하는 것처럼 보입니다. 서버에 연결하면 문제가 해결됩니다.

관련 문제