Ionic 2 + Typescript 中的 $rootScope、$scope 和 $watch 等同于什么?

What is the equivalent to $rootScope, $scope and $watch in Ionic 2 + Typescript?

我正在使用 TypeScript 在 Ionic 2 中寻找 Angular 的 $rootScope$scope$watch 的等价物。

我不知道确切的等价物,但我已将其替换为以下内容:

$rootScope:处理存储的供应商

export class AppGames {
    get GAME_NAMES(): any {
        return 'pizza/hut';
    }

$范围:this

export class BuyTopUpModalPage {
    dataList: any = [];
    constructor() {
      this.dataList = ['we', 'won']
    }

$watch:可观察

对于等同于 $rootScope,您可以对所有组件使用基础 class 并放置所有共享变量和方法

查看此答案了解更多详情