2

I am using http://angular-ui.github.io/bootstrap/ modal.

Now i want to open Modal whenever page loads

 <script> $(document).ready(function () { open('lg'); }); </script> 

2 Answers 2

2

Angular http://angular-ui.github.io/bootstrap/ has a directive and the $modal service and both of those can be used to open modal windows.

you then need to use:

$modal.dialog({}).open('modalContent.html'); 

there is a similar question in here: Invoking modal window in AngularJS Bootstrap UI using JavaScript

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

6 Comments

Forgot to add that i need to open template, not url.
@user2614879 Then pass an object with the options, instead of a url.
well this will open a template name modalCotnen.html you can added a variable and in the variable just enter the tempalte if it's not at static file
it's accualy MVC's View. Not html file, but templateURL.
FYI $dialog doesn't exist anymore. You can see in this changelog $dialog service was refactored into $modal.
|
1

Module API has a run method. In your code for you app you add code to open the dialog in the run callback

angular.module('myAppModule').run(function($modal) { $modal.open(options); //the option data. See documentation. }); 

3 Comments

Not working... angular.module('transport').run(function($modal) { $modal.open({templateUrl: 'deleteCheked.html', controller: ModalInstanceCtrl, size : size, resolve: { items: function () { return $scope.items;}}); //the option data. See documentation. });
That modal does not exsits.
error is gone (was mismatch of myAppModule name). Now problem is that nothing happens when angular.module is runned (event alert does not shoot)

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.