angularjs - Cannot read property 'open' of undefined -
i trying use angular-bootstrap keep getting error cannot read property 'open' of undefined
here how i'm using it.
in index.html i've included it
<script src="//angular-ui.github.io/bootstrap/ui-bootstrap-tpls-0.12.1.min.js"></script>
in app.js
angular .module('myapp', ['ngroute', 'ngresource', 'ui.bootstrap', 'angulardjangoregistrationauthapp', 'http-auth-interceptor', 'angularpayments', 'angularapp'])
in controller
'use strict'; angular.module('myapp') .controller('subscriptionctrl', ['$scope','$rootscope', 'djangoauth','loginrequired','validate','$location', function($scope, $rootscope, djangoauth, loginrequired, validate, $location, $modal) { $scope.open = function(index) { var modalinstance = $modal.open({ animation: $scope.animationsenabled, templateurl: 'mymodalcontent.html', controller: 'modalinstancectrl', size: size, resolve: { items: function () { return $scope.items; } } });
html
open me!
error when click "open me!" following error:
typeerror: cannot read property 'open' of undefined
you forgot indicate need $modal
dependency function:
angular.module('myapp').controller('subscriptionctrl', ['$scope','$rootscope', 'djangoauth', 'loginrequired', 'validate', '$location', '$modal', function($scope, $rootscope, djangoauth, loginrequired, validate, $location, $modal) { ...
Comments
Post a Comment