The idea is to make when calling a unique directive, it render the directive corresponding to the preconfigured CSS framework.
For this I have a global variable var window.styleSource = "bootstrap";
(after which I can set whatever value you want) that defines the CSS framework name that I will use. I also have a directive to render the contents of the bootstrap like this:
var app = angular.module('app',[]);
app.directive('navBarControlBootstrap', function () {
return {
restrict: "E",
template: "<div>teste bootstrap</div>",
replace: true
};
});
This is working okay, in the future I intend to use Metro-UI and for this I will create the navBarControlMetroui
directive.
The idea is to use the global variable to target the correct directive that will be rendered.
Now I need a% w_that is common, my attempt was as follows:
app.directive('navBarControl',function () {
return {
restrict: "E",
scope:{},
template: "<nav-bar-control-{{styleSource}}></<nav-bar-control-{{styleSource}}>",
link:function(scope){
scope.styleSource=styleSource;
}
};
});
In this way I can call nav-bar-control
in HTML and by the global variable it would callback <nav-bar-control></nav-bar-control>
, in this case returning nomeDiretiva+styleSource
content. But it's not working, any suggestions?