3
angular-ui-router 경로를 변경하면 현재 상태의 CSS가 언로드됩니다 (angular-css 사용).webpack을 사용하여 경로를 변경할 때 CSS를 언로드하는 방법은 무엇입니까?
그러나 CSS가 webpack을 사용하여 포장 된 경우 상태의 CSS는 언로드되지 않습니다.
해결 방법이 있습니까?
angular-ui-router 경로를 변경하면 현재 상태의 CSS가 언로드됩니다 (angular-css 사용).webpack을 사용하여 경로를 변경할 때 CSS를 언로드하는 방법은 무엇입니까?
그러나 CSS가 webpack을 사용하여 포장 된 경우 상태의 CSS는 언로드되지 않습니다.
해결 방법이 있습니까?
해결 방법을 찾았지만 실제 해결 방법을 선호합니다.
우리는 useable styles 결합 angular-css ($cssAdd 및 $cssRemove)
코드에서이 개 문서화되지 않은 방송은 다음과 같습니다 FALSE '옵션을 :
$rootScope.$on('$cssAdd', function (event, stylesheets) {
angular.forEach(stylesheets, function(stylesheet){
if (stylesheet.use)
stylesheet.use();
});
});
$rootScope.$on('$cssRemove', function (event, stylesheets) {
angular.forEach(stylesheets, function(stylesheet){
if (stylesheet.unuse)
stylesheet.unuse();
});
});
매우 우아한 솔루션입니다. –
당신이이'계속 시도? 하지만 이것이 기본이라고 생각합니다. –
@EmileBergeron 작동하지 않았습니다. – jrobichaud
그래, 그게 기본값이기 때문에 이미 시도해 봤어야 했지. –