ngParty / ng-metadata

Angular 2 decorators and utils for Angular 1.x

Home Page:https://hotell.gitbooks.io/ng-metadata/content/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

@Component transclusion not enabled by default

reppners opened this issue · comments

Was it intentional to not activate transclusion on components by default? I was expecting it to be on by default.

I'm also using the legacy property to set the controllerAs property, but completely not specifying legacy did not change the result.

@Component( {
    selector: "st-action-list-item",
    templateUrl: "ActionListItem.html",
    moduleId: module.id,
    legacy: {
        controllerAs: Constants.ControllerAs,
        transclude: true // thought this would not be needed
    }
} )

I'm following angular 1 in terms of transclusion. It's not enabled by default because only one directive/component allows transclusion, so if it will be enabled by default, there would be clashes.

anyway you are saying that overriding default controllerAs: '$ctrl' to your custom name doesn't work?

Plnkr or didn't happen! :D

It's not enabled by default because only one directive/component allows transclusion, so if it will be enabled by default, there would be clashes.

Good point, I did miss that! Thx for the explanation 👍

anyway you are saying that overriding default controllerAs: '$ctrl' to your custom name doesn't work?

Hehe, no worries it works as expected. I just mentioned it in case it would have been a side effect if I used the legacy object. Although I had to get rid of the controllerAs override because otherwise WebStorm 2016.3 would fail to provide autocompletion and code highlighting in the template..