Histórico da Página
...
Bloco de código | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||
appStateConfig.$inject = ['$stateProvider', '$urlRouterProvider']; function appStateConfig($stateProvider, $urlRouterProvider) { index.stateProvider = $stateProvider; // Views padrões da aplicação que não possuem 'states'. $stateProvider.state( 'about', { url: '/html-app/about', templateUrl: '/html-app/html/about.html' } ).state( 'blank', { url: '/', templateUrl: '/html-app/html/blank.html' } ); ... } // appStateConfig index.config(appStateConfig); |
...
Bloco de código | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||
appStateConfig.$inject = ['$stateProvider', '$urlRouterProvider']; function appStateConfig($stateProvider, $urlRouterProvider) { index.stateProvider = $stateProvider; ... $urlRouterProvider.otherwise(function ($injector, $location) { var view = ''; var contexto = ''; var templateurl = ''; var strs = $location.path().split('/'); if (strs.length > 2) { contexto = strs[1]; view = contexto + '/' + strs[2]; templateurl = '/' + strs[1] + '/html/' + strs[2] + '/' + strs[2]; } if (view !== "") { requirejs([templateurl + '.js'], function () { var state = $injector.get('$state'); var urlRouter = $injector.get('$urlRouter'); if (state.get(view) == null) { index.stateProvider.state(view, { abstract: true, template: '<ui-view/>' }); index.stateProvider.state(view + '.start', { url: view, templateUrl: templateurl + '.html' }); } if (strs.length > 3) { urlRouter.sync(); } else { state.go(view + '.start'); } }); } else { return '/'; } }); } // appStateConfig index.config(appStateConfig); |
...
Bloco de código | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||
define(['index', '/html-sample/html/country/country-services.js'], function(index) { // Inicializa os states da aplicação. index.stateProvider // Estado pai, a hierarquia de states é feita através do '.', e todo estado novo // tem que ter um estado pai, que nesse caso é abstrato. Este status precisa // apenas de uma template com o elemento <ui-view> para conter os estados filhos. .state('html-sample/country', { abstract: true, template: '<ui-view/>' }) // Estado inicial da tela deve ser o estado pai com o sufixo '.start' este estado // será ativado automaticamente quando a tela for carregada. // // A URL deve ser compatível com a tela inicial. // // No estado também definimos o controller usado na template do estado, e definimos // o nome do controller em 'controllerAs' para ser utilizado na view. // também definimos a template ou templateUrl com o HTML da tela da view. .state('html-sample/country.start', { url:'/html-sample/country/', controller:'framework.country-list.Control', controllerAs: 'controller', templateUrl:'/html-sample/html/country/country.list.html' }) // Note que outros estados também são filhos com sufixos conforme o objetivo da tela, // assim como o padrão da URL, controller e template. .state('html-sample/country.detail', { url:'/html-sample/country/detail/:id', controller:'framework.country-detail.Control', controllerAs: 'controller', templateUrl:'/html-sample/html/country/country.detail.html' }) .state('html-sample/country.edit', { url: '/html-sample/country/edit/:id', controller: 'framework.country-edit.Control', controllerAs: 'controller', templateUrl: '/html-sample/html/country/country.edit.html' }) .state('html-sample/country.new', { url: '/html-sample/country/new', controller: 'framework.country-edit.Control', controllerAs: 'controller', templateUrl: '/html-sample/html/country/country.edit.html' }); }); |
...
Visão Geral
Import HTML Content
Conteúdo das Ferramentas
Tarefas