Skip to content

Instantly share code, notes, and snippets.

@houming818
Created August 7, 2017 12:01
Show Gist options
  • Save houming818/6768be6ea2f6c65144a110ca239df463 to your computer and use it in GitHub Desktop.
Save houming818/6768be6ea2f6c65144a110ca239df463 to your computer and use it in GitHub Desktop.
angluarjs dynamic states example
angular.module('MetronicApp').controller('LvsGroupsController', function($model, $scope, localStorageService, $rootScope, $http, $timeout, runtimeStates, $state) {
runtimeStates.addState('lvs', {
name: 'lvs',
url: '/lvs',
data: {pageTitle: 'Lvs中心'},
templateUrl: '/static/views/lvs/main.html',
resolve: {
deps: ['$ocLazyLoad', function($ocLazyLoad) {
return $ocLazyLoad.load({
name: 'MetronicApp',
insertBefore: '#ng_load_plugins_bebore',
files: ['/static/js/lvs/workflow.js']
});
}]
}
});
runtimeStates.addState('lvs.group', {
name: 'lvs.group',
url: '/group',
data: {pageTitle: 'Lvs中心.group'},
templateUrl: '/static/views/lvs/workflow.html',
resolve: {
deps: ['$ocLazyLoad', function($ocLazyLoad) {
return $ocLazyLoad.load({
name: 'MetronicApp',
insertBefore: '#ng_load_plugins_bebore',
files: ['/static/js/lvs/workflow.js']
});
}]
}
});
$scope.new = function() {
$state.go('lvs.group');
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment