What is the difference between $routeProvider and $stateProvider?

Both do the same work as they are used for routing purposes in SPA(Single Page Application). 1. Angular Routing – per $routeProvider docs URLs to controllers and views (HTML partials). It watches $location.url() and tries to map the path to an existing route definition. HTML <div ng-view></div> Above tag will render the template from the … Read more

How to reload the current state?

I found this to be the shortest working way to refresh with ui-router: $state.go($state.current, {}, {reload: true}); //second parameter is for $stateParams Update for newer versions: $state.reload(); Which is an alias for: $state.transitionTo($state.current, $stateParams, { reload: true, inherit: false, notify: true }); Documentation: https://angular-ui.github.io/ui-router/site/#/api/ui.router.state.$state#methods_reload

How to pass parameters using ui-sref in ui-router to the controller

I’ve created an example to show how to. Updated state definition would be: $stateProvider .state(‘home’, { url: ‘/:foo?bar’, views: { ”: { templateUrl: ‘tpl.home.html’, controller: ‘MainRootCtrl’ }, … } And this would be the controller: .controller(‘MainRootCtrl’, function($scope, $state, $stateParams) { //.. var foo = $stateParams.foo; //getting fooVal var bar = $stateParams.bar; //getting barVal //.. $scope.state … Read more

What is the difference between angular-route and angular-ui-router?

ui-router is a 3rd-party module and is very powerful. It supports everything the normal ngRoute can do as well as many extra functions. Here are some common reason ui-router is chosen over ngRoute: ui-router allows for nested views and multiple named views. This is very useful with larger app where you may have pages that … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)