I am new to Angular and Require, my question is regarding the following piece of code (I have already hooked up angular and require, I can include files if asked); the bootstrap-switch element is not being initialized :
define(['myapp.ui/module', function (module) {
module.directive('bootstrapSwitch', ['$parse', '$path', function ($parse, $path) {
return {
restrict: 'A',
replace: true,
link: function (scope, element) {
//load requirements for this directive.
console.log(element.bootstrapSwitch);
element.bootstrapSwitch();
}
};
return require([
'myapp.ui/switch/bootstrap-switch.min',
'css!myapp.ui/switch/bootstrap-switch.min'],
function () {
return {
restrict: 'A',
replace: false,
link: function (scope, element) {
//load requirements for this directive.
element.bootstrapSwitch();
}
};
});
}]);
}]);
I am able to see the directive file being loaded (the one above), but the element is not initialized, I fail to see bootstrap-switch.min.css and bootstrap-switch.min.js (I know the paths are working, I'm sure I have a sintax problem somewhere. If not, please elaborate. Any help would be appreciated!!!!
Thank you!!!