Skip to content

Configure TemplateBegin  #36

@rupeshtiwari

Description

@rupeshtiwari

Hi
In my case I have typescript directive which we convert to js and then apply angular embed template on it. Our case template is not beginning with template: or template:string= rather it is template= see below code. Can we configure TemplateBegin from options so that end user can pass it ?

module SplashScreen {

    export class SplashScreenDirective implements ng.IDirective {

        public restrict: string;
        public controller: string;
        public templateUrl: string;
        public scope: any;
        public link: (scope: any, instanceElement: any, instanceAttributes: ng.IAttributes) => void;

        public static $inject: string[] = ["baseUrl"];

        constructor(baseUrl: string) {
            this.restrict = 'E';
            this.controller = 'splashScreenController';
            this.templateUrl =  'js/infrastructure/splashscreen/splashscreen.template.html';
            this.scope = {
                showError: '=?'
            };
            this.link = ($scope) => {

                $scope.$watch(() => { return $scope.showError; }, (value) => {
                    if (value) {
                        $scope.onShowingError();
                    }
                });
            };
        }
    }

    SplashScreen.Module.directive('splashScreen', ['baseUrl', (baseUrl) => new SplashScreenDirective(baseUrl)]);
}

Compiled JavaScript:
```javascript
"use strict";
var SplashScreen;
(function (SplashScreen) {
    var SplashScreenDirective = /** @class */ (function () {
        function SplashScreenDirective(baseUrl) {
            this.restrict = 'E';
            this.controller = 'splashScreenController';
            this.templateUrl = 'js/infrastructure/splashscreen/splashscreen.template.html';
            this.scope = {
                showError: '=?'
            };
            this.link = function ($scope) {
                $scope.$watch(function () { return $scope.showError; }, function (value) {
                    if (value) {
                        $scope.onShowingError();
                    }
                });
            };
        }
        SplashScreenDirective.$inject = ["baseUrl"];
        return SplashScreenDirective;
    }());
    SplashScreen.SplashScreenDirective = SplashScreenDirective;
    SplashScreen.Module.directive('splashScreen', ['baseUrl', function (baseUrl) { return new SplashScreenDirective(baseUrl); }]);
})(SplashScreen || (SplashScreen = {}));

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions