Closed dmarcelino closed 9 years ago
Looking at the code in angular-ui-router-title.js#L18:
title: getTitleValue(state.locals.globals.$title),
It seems my workaround breaks the breadcrumbs... :disappointed:
I wonder if it would make sense to support an attribute named $meta
in addition/alternative to $title
which would be an object instead of a string... Would that be within scope?
I don't anticipate any changes in the future that would make assumptions about $title
being a string, so having $title
return a {title, description}
object is perfectly valid.
I don't want to complicate the module by being responsible for additional meta data like the $description
since ui-state
already has good support for supporting state-specific data.
data
property inherits attributes from parent states and can be accessed as $state.$current.data
. resolve
property can inject dynamic values which can be accessed via the (undocumented) $state.$current.locals.globals
.What my module adds is the convenience of putting $title
on the root scope and, more importantly, delaying when the $rootScope.$title
is set so that it doesn't update the page title prematurely. This really only comes into play when updating the <title>
tag.
For dynamic values, the state's resolve property can inject dynamic values which can be accessed via the (undocumented)
$state.$current.locals.globals
.
I didn't know about $state.$current.locals.globals
, let me try it, it will likely fix my current issue.
It does fix the issue, thanks.
Sorry for spamming you @nonplus, I was wondering if it would make sense to add support for metadata such as
$description
?Right now I'm working around it by resolving
$title
to an object such as:And then:
Is this valid in the sense that future changes won't enforce
$title
to be a string?