reverting derived-expression back to a directive because its an attribute directive and can't be converted to a component
import * as angular from 'angular';
+
import * as _ from "underscore";
-import {moduleName} from "../../module-name";
-import { IAugmentedJQuery } from '@angular/upgrade/static/src/common/angular1';
-import {Input} from "@angular/core";
-export class DerivedExpressionController {
+import { moduleName } from "../../module-name";
+import { RegisterTemplateServiceFactory } from '../../../services/RegisterTemplateServiceFactory';
- @Input()
- public ngModel: string;
- static readonly $inject = ["$scope","$element","RegisterTemplateService"];
- constructor(private $scope: IScope,private $element: angular.IAugmentedJQuery,private RegisterTemplateService:any){
+var directive = function (RegisterTemplateService: RegisterTemplateServiceFactory) {
+ return {
+ restrict: "A",
+ scope: {
+ ngModel: '='
+ },
+ link: function ($scope: any, $element: any, attrs: any, controller: any) {
$scope.$watch(
'ngModel',
- (newValue:any) => {
+ function (newValue: any) {
if (newValue != null) {
- var derivedValue = this.RegisterTemplateService.deriveExpression(newValue,true)
- this.$element.html(derivedValue);
+ var derivedValue = RegisterTemplateService.deriveExpression(newValue, true)
+ $element.html(derivedValue);
}
else {
- this.$element.html('');
+ $element.html('');
}
});
-
}
+ };
}
+angular.module(moduleName)
+
+ .directive('thinkbigDerivedExpression', ['RegisterTemplateService', directive]);
-angular.module(moduleName).component('thinkbigDerivedExpression',{
- bindings : {
- ngModel : "="
- },
- controller : DerivedExpressionController
-});
\ No newline at end of file
