angularjs - TypeScript 中指令、编译(前/后)的等价物是什么?

标签 angularjs angularjs-directive typescript equivalent

我有一个问题,指令的等价物是什么:编译(前/后)?

javascript 中的示例:

angular.module('app').directive('checkBox', function () {
  return {
      //... my directive options

      compile: function () {
           return function () {
               pre: function (scope) {}
               post: function (scope) {}
           }
      }
  }
});

什么是 TypeScript?

最佳答案

它将等同于:

public compile = (element: JQuery, attrs: angular.IAttributes, transclude: any): DirectivePrePost => {
            return {
                pre: ($scope: any, element: JQuery, attrs: angular.IAttributes) => {

                },
                post: ($scope: any, element: JQuery, attrs: angular.IAttributes) => {

                }
            };
        }

关于angularjs - TypeScript 中指令、编译(前/后)的等价物是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26202456/

相关文章:

javascript - 为什么 Angular 在使用不同的字符串时表现出意外?

javascript - AngularJS 中的第一个、ng-include 或 ng-repeat 是什么?

java - 缓存 REST 方法

javascript - 具有自定义比例的负 AngularJS slider

javascript - 为什么我的 js 函数返回的是自身而不是返回值? [ Angular ]

angularjs - 如何在 Angular js中制作自定义指令或在指令中传递变量

javascript - 如何用 JEST 测试 promise 递归

angular - 如何从 Angular 2 中的回调函数调用父函数?

javascript - Object.assign 在构造函数之外被覆盖

AngularJS指令: how to check for transcluded content