0

I'm having this problem trying to use modals in angular

$modalProvider <- $modal <- User.Ctlr

Here's my app.js

'use-strict';

var App = angular.module('App', ['ui.bootstrap']);

Here's my controller

'use strict';

App.controller('User.Ctlr', ['$scope', '$modal', '$http', function ($scope, $modal, $http) { 
}]);

Here's my HTML

<body ng-app="App">
    <div class="container" ng-controller="User.Ctlr">
     </div>
</body>
<script src="/scripts/lib/jquery-1.9.1.min.js"></script>
<script src="/scripts/lib/angular.min.js"></script>
<script src="/scripts/lib/bootstrap.js"></script>
<script src="/scripts/lib/ui-bootstrap-tpls-2.2.0.min.js"></script>
<script src="/scripts/app/app.js"></script>
<script src="/scripts/app/controllers/userCtrl.js"></script>

I'm not understanding what could be wrong, it used to work properly when I didn't have modals, so my controller was exactly the same but the variable $modal.

2 Answers 2

0

You need to inject $modalInstance instead of modal

app.controller('User.Ctlr', function ($scope, $modalInstance, $http)
{
   //Use modalInstance
});

DEMO

Sign up to request clarification or add additional context in comments.

Comments

0

I changed

<script src="/scripts/lib/ui-bootstrap-tpls-2.2.0.min.js"></script>

For

<script src="http://angular-ui.github.io/bootstrap/ui-bootstrap-tpls-0.9.0.js"></script>

And now it's working properly! Thanks

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.