【发布时间】:2018-03-06 23:42:30
【问题描述】:
我想从其他页面 (otherpage.ts) 或其他组件访问和更改 app.component.ts 变量或访问方法;
app.component.ts
@Component({
templateUrl: 'app.html'
})
export class MyApp {
accessedVariable: any;
constructor(){ }
accessedMethod() {
..something
}
}
otherpage.ts
@Component({
selector: 'page-other',
templateUrl: './otherpage.html',
})
export class OtherPage {
constructor() { }
}
【问题讨论】:
-
OtherPage是MyApp的孩子吗? -
@Dr.Geek 你能简要解释一下你正在尝试做什么,尤其是accessedMethod。另外,app.component 和 otherpage parent 是否相关或完全分开
标签: angular typescript ionic-framework ionic3