将指令重构为angularJS中的组件

时间:2018-06-01 12:08:19

标签: javascript angularjs typescript components

我试图将此指令转换为组件,但我不知道如何去做。

  export class TableRowBSHeaderDirective implements ng.IDirective {
    restrict: string = 'A';

    templateUrl: any = balanceSheetFSPolicy.dirvmConstant.TableRowHeaderTmpl;

    controller: any = ($scope: any) => {
        balanceSheetFSPolicy.balanceSheetFSViewModel = $scope.bsFsVm;
        $scope.balanceSheetFSPolicy = balanceSheetFSPolicy;
    };

    static factory(): ng.IDirectiveFactory {
        const directive = function () {
            return new TableRowBSHeaderDirective();
        };
        return directive;
    }
}

angular
    .module('app.recon.statements')
    .directive('tableRowBsHeader', TableRowBSHeaderDirective.factory());

0 个答案:

没有答案