ui-router-metatags icon indicating copy to clipboard operation
ui-router-metatags copied to clipboard

Documentation on nested states

Open thatisuday opened this issue 9 years ago • 5 comments

I am having trouble working with nested states. I have no idea how this modules handles nested states, hence can you please show us some examples on this topic?

thatisuday avatar Jul 28 '16 06:07 thatisuday

I am guessing as stateChangeSuccess event is fired for every nested state and perhaps this module does not understand if the state have a parent. Hence it fallback to default title and description if current state is missing metaTags

thatisuday avatar Jul 28 '16 06:07 thatisuday

I haven't looked into api documentation of UI-Router but is it possible to traverse state tree upward to perhaps instead of falling to default meta-tags, we could fallback to parent or if we could provide such option in the configuration options.

thatisuday avatar Jul 28 '16 06:07 thatisuday

If that is impossible, how to reuse resolve dependency from a parent state? Because I do not wish to ajax same contents in child states...

thatisuday avatar Jul 28 '16 06:07 thatisuday

Its been a while since I looked into this, but as far as I remember, the event is only thrown once.

But... is there actually a question in here? Do you have a problem with what the module does?

tinusn avatar Sep 18 '16 19:09 tinusn

@thatisuday are you still having an issue here? or can this issue be closed?

With UI-Router you can inject resolved data:

resolve: {
    identityResolve: ['identity', function(identity) {
	return identity.initialize().$promise;
    }]
},
metaTags: {
    title: function(identityResolve) {
	return identityResolve.meta.index.title + ' | ' + identityResolve.client.name;
    },
    description: function(identityResolve) {
	return identityResolve.meta.index.description;
    }
}

johnjspiteri avatar Dec 19 '16 01:12 johnjspiteri