mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
update document.title on view change
This commit is contained in:
@@ -103,8 +103,7 @@ export class Navbar extends ToolbarBase {
|
||||
}
|
||||
|
||||
didEnter() {
|
||||
// const titleEle = this._ttEle || (this._ttEle = this.getNativeElement().querySelector('ion-title'));
|
||||
// titleEle && this.app.title(titleEle.textContent);
|
||||
this.app.title(this.getTitleText());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -21,16 +21,20 @@ export class ToolbarBase extends Ion {
|
||||
this.titleRef = null;
|
||||
}
|
||||
|
||||
setTitleCmp(titleCmp) {
|
||||
this.titleCmp = titleCmp;
|
||||
}
|
||||
|
||||
getTitleText() {
|
||||
return (this.titleCmp && this.titleCmp.getTitleText()) || '';
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO
|
||||
* @returns {TODO} TODO
|
||||
*/
|
||||
getTitleRef() {
|
||||
return this.titleRef;
|
||||
}
|
||||
|
||||
setTitleRef(titleElementRef) {
|
||||
this.titleRef = titleElementRef;
|
||||
return this.titleCmp && this.titleCmp.elementRef.textContent;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -94,8 +98,12 @@ export class ToolbarTitle extends Ion {
|
||||
@Optional() @Inject(forwardRef(() => Navbar)) navbar: Navbar
|
||||
) {
|
||||
super(elementRef, null);
|
||||
toolbar && toolbar.setTitleRef(elementRef);
|
||||
navbar && navbar.setTitleRef(elementRef);
|
||||
toolbar && toolbar.setTitleCmp(this);
|
||||
navbar && navbar.setTitleCmp(this);
|
||||
}
|
||||
|
||||
getTitleText() {
|
||||
return this.getNativeElement().textContent;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user