-2

Hi I am using one small directive for hide and show bootstrap modal from controller which was working fine when i was not using ngAnimate. But after inclusing ngAnimate it shows

element.modal is not a function

below is my directive

app.directive('akModal', function() {
    return {
        restrict: 'A',
        link: function(scope, element, attrs) {

            scope.$watch(attrs.akModal, function(value) {
                if (value) element.modal('show');
                else element.modal('hide');
            });
        }
    };
});

any fixes?

AngularDev
  • 144
  • 1
  • 10
  • 1
    `modal` isn't a standard jqLite method: https://docs.angularjs.org/api/ng/function/angular.element#angular-s-jqlite We need more information about your environment. Do you have another angular module providing this method? – Jackson Dec 02 '14 at 09:07
  • actually it is for bootsrap modal. I forgot to mention – AngularDev Dec 02 '14 at 09:08
  • Instead of helping u guys just down vote people. Cheeers!!! – AngularDev Dec 02 '14 at 09:20

1 Answers1

0

Managed to do it myself.

actually we should load bootsrap.js befor NGAnimate to avoid clashes.

Reason: element.modal function is created in bootsrap.js so it should be loaded in order to use it afterwards.

AngularDev
  • 144
  • 1
  • 10