Directives as class in bootstrap ui modal not compiling
I'm trying to pass a directive as a class in the windowClass field, but it doesn't seem to compile and so the directive isn't being called.
modal:
...
$modal.open({
templateUrl: 'modal.html',
scope: scope,
controller: 'myCtrl as controller',
backdrop: false,
windowClass: 'directive'
})
.result.then(function (data) {
// something
});
...
directive:
...
.directive('directive', function() {
return {
link: function(scope, element, attr) {
var modal = element;
console.log("directive called");
// real code goes there
}
};
});
...
With this configuration, the directive will never be called.
I am using a workaround for now, but I am not satisfied with this:
directive:
...
.directive('directive', function() {
return {
link: function(scope, element, attr) {
var modal = element.parent().parent().parent();
console.log("directive called");
// real code goes there
}
};
});
...
modal.html:
<div directive>
<!-- something -->
</div>
I found the same question here , but it has no answer other than my workaround, so I rewrite it with the appropriate tag: angular-ui-bootstrap as pointed out in the github repo , hoping for a better answer.
I use:
- angular v1.3
- angular-ui / bootstrap v0.13.0 (latest version)
source to share
UPDATE : See comment below.
We are not currently recompiling the item. Most likely we are calling $element.addClass
and passing a user-specified value windowClass
.
However, we think there may be a precedent for this, and you would like you to please introduce a new issue here if you don’t think.
Please link this SO post to a new issue. Thank.
source to share