{"action":"reopened","issue":{"url":"https://api.github.com/repos/angular/angular/issues/7845","repository_url":"https://api.github.com/repos/angular/angular","labels_url":"https://api.github.com/repos/angular/angular/issues/7845/labels{/name}","comments_url":"https://api.github.com/repos/angular/angular/issues/7845/comments","events_url":"https://api.github.com/repos/angular/angular/issues/7845/events","html_url":"https://github.com/angular/angular/issues/7845","id":144814249,"number":7845,"title":"CSS style not applying on dynamic injected html elements","user":{"login":"srehanuddin","id":1668868,"avatar_url":"https://avatars.githubusercontent.com/u/1668868?v=3","gravatar_id":"","url":"https://api.github.com/users/srehanuddin","html_url":"https://github.com/srehanuddin","followers_url":"https://api.github.com/users/srehanuddin/followers","following_url":"https://api.github.com/users/srehanuddin/following{/other_user}","gists_url":"https://api.github.com/users/srehanuddin/gists{/gist_id}","starred_url":"https://api.github.com/users/srehanuddin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/srehanuddin/subscriptions","organizations_url":"https://api.github.com/users/srehanuddin/orgs","repos_url":"https://api.github.com/users/srehanuddin/repos","events_url":"https://api.github.com/users/srehanuddin/events{/privacy}","received_events_url":"https://api.github.com/users/srehanuddin/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2016-03-31T07:34:13Z","updated_at":"2016-10-09T15:41:48Z","closed_at":null,"body":"I am using Angular 2.0.0-beta.12 & D3, i am injecting D3 barchart after viewInit, and inject css in component by adding attribute \"styles\", element injected and display on browser, but css is not apply on dynamic elements which are created by D3, found an issue, after component initialization css embed in document head tag, and all css selectors changed to .myClass[_ngcontent-[variable]], and this variable attribute attached to all elements of that component, but not with dynamically appended components.\r\n\r\nhere are my code\r\n\r\n```\r\n@Component({\r\n    selector: 'app',\r\n        template: `\r\n            <h1>D3.js Integrated if background is yellow</h1>\r\n            \r\n            style apply on this static element but not dynamic element\r\n            <svg><rect class=\"bar\" width=\"200\" height=\"200\"></rect></svg>\r\n        `,\r\n        styles : [`.bar { fill: steelblue; } .bar:hover { fill: brown; }\r\n` ]\r\n})\r\nclass App { \r\n\r\n    constructor(public elementRef: ElementRef){\r\n    } \r\n    \r\n    ngOnInit(){\r\n        var componentContainer = d3.select(this.elementRef.nativeElement);\r\n        \r\n        componentContainer.select(\"h1\").style(\"background-color\", \"yellow\");\r\n\r\n//Dynamic Element Injeciton\r\n        componentContainer.append(\"svg\")\r\n            .append(\"rect\")\r\n            .attr(\"class\", \"bar\")\r\n            .attr(\"width\", 200)\r\n            .attr(\"height\", 200);\r\n    }\r\n    \r\n}\r\n```"}}
{"actor":{"display_login":"pkozlowski-opensource"}}