Skip to content
This repository has been archived by the owner on Jan 18, 2024. It is now read-only.

softsimon/ui-router-route-to-components

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ui-router-route-to-components

Route to components today using Angular 1.5+ and ui-router 0.2.x+

Usage

Add module dependency 'ui.router.components'

Example state config:

.state('users', {
	parent		: 'header',
	url			: '/users/:id',
	component  : 'users',
})

Or

.state('users', {
	parent		: 'header',
	url			: '/users/:id',
	views			: {
		'content@': {
			component  : 'users',
		}
	}
})

Resolve:

.state('users', {
	parent		: 'header',
	url			: '/users/:id',
	component  : 'users',
	resolve: {
        data: function () {
	        return "some data";
        }
	}
})

.component('users', {
    bindings: {
        data: '<'
    },
    controller: UsersController,
    templateUrl: '../app/users/users.template.html',
});

function UsersController() {
    console.log(this.data); // "some data"
}

Credits

Code mostly borrowed from angular-ui/ui-router#2547 but extended to also support multiple named views.

About

UI-Router Route To Component Extension

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •