[Angular] CSS in angular-cli working but CSS in styleurl of component not working

1,229 views
Skip to first unread message

Academia Learning Centro de inglés y de formación

unread,
Mar 22, 2017, 2:12:54 PM3/22/17
to Angular and AngularJS discussion
Hello,

On both occasions the css is loaded in the head of the html but if it is declared in the angular-cli styles apply to the html elements and 
if I declare it in the component's styleurl, although it is loaded into the html, it does not apply to the elements Html.

Any suggestions?

Miroslav Zografski

unread,
Mar 23, 2017, 1:29:53 AM3/23/17
to Angular and AngularJS discussion
Please, provide codw sample of one of your components with style that dies not apply. Together with its template.

Academia Learning Centro de inglés y de formación

unread,
Mar 23, 2017, 4:07:14 AM3/23/17
to Angular and AngularJS discussion
Hello, If I declare the css in angular-cli.json works

"styles": [    
      "app/client/patient/search/components/resources/css/component-search.css",
       "styles.css"

],







But if I declare it in the component's styleurl

@Component({
    selector: 'hn-search',
    templateUrl: './resources/template/component-search.html',
    styleUrls: ['./resources/css/component-search.css']
})






Is also loaded into the html but then does not work on the element.


Thanks

Academia Learning Centro de inglés y de formación

unread,
Mar 27, 2017, 3:47:51 AM3/27/17
to Angular and AngularJS discussion
Help

Sander Elias

unread,
Mar 27, 2017, 6:24:30 AM3/27/17
to Angular and AngularJS discussion
Hi,

Reproduce your issue in a plnk, and it becomes much easier to help you. 

Academia Learning Centro de inglés y de formación

unread,
Mar 27, 2017, 8:06:03 AM3/27/17
to Angular and AngularJS discussion
Thanks, I found the problem, this was

encapsulation: ViewEncapsulation.None,
Reply all
Reply to author
Forward
0 new messages