AngularJS – UI-router – How to configure dynamic views

There is a plunker showing how we can configure the views dynamically. The updated version of the .run() would be like this: app.run([‘$q’, ‘$rootScope’, ‘$state’, ‘$http’, function ($q, $rootScope, $state, $http) { $http.get(“myJson.json”) .success(function(data) { angular.forEach(data, function (value, key) { var state = { “url”: value.url, “parent” : value.parent, “abstract”: value.abstract, “views”: {} }; // … Read more

How to do an angularjs multi-step/wizard form on one page/url

I think the best way of doing this would be to use ng-switch, just one controller, one route, no reload, using variables shared in all steps, like this: <div ng-controller=”stepCtrl”> <div ng-switch=”step”> <div ng-switch-when=”1″> <!– here you can include your step 1 template, or simply just hardcode it here: –> <div ng-include src=”‘…/step1.html'”> <button ng-click=”setStep(1)”></button> … Read more

angular UI router | $stateParams not working

You can’t pass arbitrary parameters between states, you need to have them defined as part of your $stateProvider definition. E.g. $stateProvider .state(‘contacts.detail’, { url: “/contacts/:contactId”, templateUrl: ‘contacts.detail.html’, controller: function ($stateParams) { console.log($stateParams); } }) … The above will output an object with the contactId property defined. If you go to /contacts/42, your $stateParams will be … Read more

tech