Is there a way to automatically close Angular UI Bootstrap modal when route changes?

If you want all the opened modals to be closed whenever a route is changed successfully, you could do it in one central place by listening to the $routeChangeSuccess event, for example in a run block of your app: var myApp = angular.module(‘app’, []).run(function($rootScope, $uibModalStack) { $uibModalStack.dismissAll(); }); Here you can see that the $uibModalStack … Read more

ui-router resolve with dynamic parameters

You were close with $routeParams. If you use ui-router use $stateParams instead. This code works for me: .state(‘recipes.category’, { url: ‘/:cat’, templateUrl: ‘/partials/recipes.category.html’, controller: ‘RecipesCategoryCtrl’, resolve: { category: [‘$http’,’$stateParams’, function($http, $stateParams) { return $http.get(‘/recipes/’ + $stateParams.cat) .then(function(data) { return data.data; }); }] } })

Angular ui bootstrap directive template missing

You have two choices: If you don’t want to make your own templates and want the built in ones, you should download the ui-bootstrap-tpls-0.1.0.js file – this injects all the templates so they are pre-cached into your app: https://github.com/angular-ui/bootstrap/blob/gh-pages/ui-bootstrap-tpls-0.1.0.js#L1322 If you do want to make some of your own templates, create a templates folder in … Read more

Enable angular-ui tooltip on custom events

Here’s a trick. Twitter Bootstrap tooltips (that Angular-UI relies upon) have an option to specify the trigger event with an additional attribute as in data-trigger=”mouseenter”. This gives you a way of changing the trigger programmatically (with Angular): <input ng-model=”user.username” name=”username” tooltip=”Some text” tooltip-trigger=”{{{true: ‘mouseenter’, false: ‘never’}[myForm.username.$invalid]}}” /> So when username is $invalid, the tooltip-triggerexpression will … Read more

angularjs ui-router – how to build master state which is global across app

The approach you took in your plunker is close. @ben-schwartz’s solution demonstrates how you’d set defaults in your root state for the three essentially-static views. The thing missing in your plunker is that your child states still need to reference the top container view. .state(‘root’,{ url: ”, views: { ‘header’: { templateUrl: ‘header.html’, controller: ‘HeaderCtrl’ … Read more

Angular ui-router: ui-views vs directives?

How about if you used Angular UI router’s inline views to point to directives? Let’s say you have a directive for a table that handles CRUD operations on user accounts. We’ll say the directive is named user-admin. Our routes file would look like: .state(‘users’, { url: “https://stackoverflow.com/users”, template: “<user-admin>” }); This would give you many … Read more