Angular UI Bootstrap modals load template Solution

Angular UI Bootstrap modals load template Solution

simple in angularjs modal popup ,All was very well and using Angular.js using libs to together with Twitter Bootstrap load template totally made my day. so then I needed or provided to show a modal dialog box to Dom elements. I know how to do this stuff so I stumbled upon open or closed the Angular UI directives for using the Bootstrap this seemed great.means other sense to I mean, that’s just awesome. as well as to Using the powerful check of Angular’s directives should all the get these modals up dialog and running super very fast.

Simple Installation check

angular.module('myModule', ['ui.bootstrap']);

CSS

.nav, .pagination, .carousel, .panel-title a { cursor: pointer; }

IMP Note : You must load the fisrt the ui.boostrap module after the libs of angularjs file.For Using Angular UI Bootstrap modals

READ :  Angular Nested ng repeat Example with Demo

You have to include following after angular.min.js file

<a href="http://..//ui-bootstrap-custom-tpls-0.12.0.min.js">http://..//ui-bootstrap-custom-tpls-0.12.0.min.js</a>

Solve the UI Bootstrap modal error: Failed to load template

Failed to here in angularjs load template: template/modal/backdrop.html example error

Make the sure you’re very easy way to the linking to the UI Bootstrap used library with the HTML templates included (Like as a ui-bootstrap-tpls.js) and not simple any of the plain UI Bootstrap libs = library (Like as a ui-bootstrap.js).

<a href="//angular-ui.github.io/bootstrap/ui-bootstrap-tpls-0.10.0.js">//angular-ui.github.io/bootstrap/ui-bootstrap-tpls-0.10.0.js</a>

Full Example of resolve error for Angular-UI Bootstrap alert service for Angular.js

Script.js

(function(){
    var ng4app = angular.module('cmsRecipesModule', ['ui.bootstrap']);
    ng4app.controller('cmprojectCtrl', [
        '$scope',
        '$rootScope',
        'recipeService',
        '$modal',
        function($scope, $rootScope, recipeService, $modal){
            $scope.recipes = recipeService.recipes;
 
            $scope.removereceipt = function(id) {
                $modal.open({
                    templateUrl: '/templates/modal.html',
                    controller: 'popupmodalCtrl'
                });
            }
        }
    ]);
 
    ng4app.controller('popupmodalCtrl', [
        '$scope',
        '$modalInstance',
        function($scope, $modalInstance){
			//display message
            console.log('instance');
        }]);
})();

Body Part

<div class="modal-header">
    <h3 class="modal-title">angular ui bootstrap tutorial</h3>
</div>
<div class="modal-body">
</div>
<div class="modal-footer">
    <button class="btn btn-primary">OK</button>
    <button class="btn btn-warning">Cancel</button>
</div>

ui.bootstrap Demo

READ :  convert generic list to datatable in Asp.Net C#,VB

Leave a Reply

Your email address will not be published. Required fields are marked *