Skip to content

Instantly share code, notes, and snippets.

@zergin
Created September 12, 2012 19:36
Show Gist options
  • Save zergin/3709335 to your computer and use it in GitHub Desktop.
Save zergin/3709335 to your computer and use it in GitHub Desktop.
Angular.js: Load CSS files per template
$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