angular-css icon indicating copy to clipboard operation
angular-css copied to clipboard

Dynamic CSS URL

Open sasidhar opened this issue 10 years ago • 3 comments

Currently I am using a dynamic template URL using a function as given below in the Routes.

.when('/:page', {
    templateUrl : function(url) {
        return '/static/partials/' + url.page + '/template.html';
    },
    ....
}

When I tried the same with CSS, it is unable to find "url"

css : function(url) {
    return '/static/partials/' + url.page + '/styles.css'; 
}

Is there any chance that we can provide Dynamic CSS URL as mentioned above?

sasidhar avatar May 14 '15 09:05 sasidhar

I have the same need, because I want to use themes depended on a param. Can you try this and report if it works:

    css : function($stateParams) {
        return '/static/partials/' + $stateParams.page + '/styles.css'; 
    }

and

    css : function($state) {
        return '/static/partials/' + $state.params.page + '/styles.css'; 
    }

360disrupt avatar Jul 07 '15 21:07 360disrupt

When the functions returns an Array it only handles the last entry.

bbuhler avatar Sep 24 '15 11:09 bbuhler

+1

Mouvedia avatar Nov 04 '15 15:11 Mouvedia