Created
September 12, 2012 19:36
-
-
Save zergin/3709335 to your computer and use it in GitHub Desktop.
Angular.js: Load CSS files per template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$scope.$on('$viewContentLoaded', function() { | |
$scope._style = document.createElement('link'); | |
$scope._style.type = 'text/css'; | |
$scope._style.href = 'application/Invoice/Resource/single.css'; | |
$scope._style.rel = 'stylesheet'; | |
$scope._style = document.head.appendChild($scope._style); | |
}); | |
$scope.$on('$destroy', function() { | |
$scope._style.parentNode.removeChild($scope._style); | |
delete $scope._style; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment