{"action":"created","issue":{"url":"https://api.github.com/repos/angular/angular/issues/6525","repository_url":"https://api.github.com/repos/angular/angular","labels_url":"https://api.github.com/repos/angular/angular/issues/6525/labels{/name}","comments_url":"https://api.github.com/repos/angular/angular/issues/6525/comments","events_url":"https://api.github.com/repos/angular/angular/issues/6525/events","html_url":"https://github.com/angular/angular/issues/6525","id":127008875,"number":6525,"title":"Missing a way to retrieve innerHTML of the original element","user":{"login":"kayue","id":193112,"avatar_url":"https://avatars.githubusercontent.com/u/193112?v=3","gravatar_id":"","url":"https://api.github.com/users/kayue","html_url":"https://github.com/kayue","followers_url":"https://api.github.com/users/kayue/followers","following_url":"https://api.github.com/users/kayue/following{/other_user}","gists_url":"https://api.github.com/users/kayue/gists{/gist_id}","starred_url":"https://api.github.com/users/kayue/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kayue/subscriptions","organizations_url":"https://api.github.com/users/kayue/orgs","repos_url":"https://api.github.com/users/kayue/repos","events_url":"https://api.github.com/users/kayue/events{/privacy}","received_events_url":"https://api.github.com/users/kayue/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":11,"created_at":"2016-01-16T07:48:42Z","updated_at":"2016-10-10T13:17:04Z","closed_at":"2016-01-20T20:39:18Z","body":"I think Angular 2 is missing a way to retrieve innerHTML of the original element\r\n\r\n```html\r\n<foo>SOME TEXT HERE</foo>\r\n```\r\n\r\nI know I can render the original content with `<ng-content>`\r\n\r\n```js\r\n@Component({\r\n    selector: 'foo',\r\n    template: '<ng-content></ng-content>'\r\n})\r\n```\r\n\r\nHowever there is no way I can retrieve the original content in constructor, or anywhere in the code.\r\nThe `@Input` is only able to access attribute, but not inner HTML. \r\nAnd the `ElementRef` in constructor is a already modified element.\r\nMay I know what is the proper way to get inner HTML of the element?"},"comment":{"url":"https://api.github.com/repos/angular/angular/issues/comments/252615279","html_url":"https://github.com/angular/angular/issues/6525#issuecomment-252615279","issue_url":"https://api.github.com/repos/angular/angular/issues/6525","id":252615279,"user":{"login":"tom10271","id":5089629,"avatar_url":"https://avatars.githubusercontent.com/u/5089629?v=3","gravatar_id":"","url":"https://api.github.com/users/tom10271","html_url":"https://github.com/tom10271","followers_url":"https://api.github.com/users/tom10271/followers","following_url":"https://api.github.com/users/tom10271/following{/other_user}","gists_url":"https://api.github.com/users/tom10271/gists{/gist_id}","starred_url":"https://api.github.com/users/tom10271/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tom10271/subscriptions","organizations_url":"https://api.github.com/users/tom10271/orgs","repos_url":"https://api.github.com/users/tom10271/repos","events_url":"https://api.github.com/users/tom10271/events{/privacy}","received_events_url":"https://api.github.com/users/tom10271/received_events","type":"User","site_admin":false},"created_at":"2016-10-10T13:17:03Z","updated_at":"2016-10-10T13:17:03Z","body":"I think you are doing it wrong, you should use pipe but not directives to\nhandle translations.\n\nI know there is a library handle translation for you in Angular 2. Try to\nsearch for it.\n\n2016-10-10 20:49 GMT+08:00 Falko <notifications@github.com>:\n\n> Hi there I'm trying to create a translate directive for i18n like the\n> following\n> import { Directive, ElementRef } from '@angular/core';\n>\n> /**\n>  * TranslateDirective\n>  * Translates the innerHTML of a DOM element.\n>  *\n>  * usage:\n>  * ```\n>  * <h1 translate>Edit</h1>\n>  * ```\n>  */\n> @Directive({\n>     selector: '[translate]',\n> })\n> export class TranslateDirective {\n>     static get parameters() {\n>         return [[ElementRef]];\n>     }\n>     constructor(el) {\n>         el.nativeElement.innerHTML = translationTable[el.nativeElement.innerHTML]['en'];\n>     }\n> }\n>\n> As I understood this discussion this is not possible. Are there any\n> alternatives?\n>\n> —\n> You are receiving this because you commented.\n> Reply to this email directly, view it on GitHub\n> <https://github.com/angular/angular/issues/6525#issuecomment-252609101>,\n> or mute the thread\n> <https://github.com/notifications/unsubscribe-auth/AE2pXcXE4OEofQ7BDm503VVkyOkG7dkZks5qyjRcgaJpZM4HGOD3>\n> .\n>\n"}}
{"actor":{"display_login":"tom10271"}}