Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding a new property to @Component decorator #197

Open
ciel opened this issue Feb 27, 2017 · 5 comments
Open

adding a new property to @Component decorator #197

ciel opened this issue Feb 27, 2017 · 5 comments

Comments

@ciel
Copy link

ciel commented Feb 27, 2017

I'm trying to use angular-css to add scoped component css to a project using ng-metadata, but I'm hitting a wall.

angular-css needs a string | string[] property on the component initialization. Like so;

{ 
   selector: 'divNg',
   templateUrl: 'tmpl.html',
   css: 'styles.css'
}

This is proving troublesome because the @Component decorator doesn't allow this property. Is there any way around this?

@DaSchTour
Copy link

I'm not 100% sure of this. But angular2 has a style property for components. I never tried to use it with angular2 or ng-metadata. But maybe it already works with ng-metadata like with angular2. If not the angular2 syntax should be used and then angular-css should not be needed anymore.

@ciel
Copy link
Author

ciel commented Mar 1, 2017

The styles property from ng-metadata does nothing for components that I can tell. It's purely there to conform to the angular 2 spec. I dove deep into the code and could also find no evidence that it does anything.

@aciccarello
Copy link
Collaborator

I wonder if the legacy option passes through the options to the directive configuration. I would assume not but it is worth a try.

{ 
   selector: 'divNg',
   templateUrl: 'tmpl.html',
   legacy: {
       css: 'styles.css'
    }
}

@ciel
Copy link
Author

ciel commented Mar 1, 2017 via email

@aciccarello
Copy link
Collaborator

I know you can get the metadata pretty easily. I think they'd be open to a PR assuming it doesn't cause build problems for other people.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants