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

Feature Request: $compile alternative API #8778

Closed
lacolaco opened this issue May 23, 2016 · 3 comments
Closed

Feature Request: $compile alternative API #8778

lacolaco opened this issue May 23, 2016 · 3 comments

Comments

@lacolaco
Copy link
Contributor

I want $compile alternative API in Angular 2.

Use-case

@Component({
  selector: "app",
  template: `
    <app-shell>
      <app-content [src]="content"></app-content>
    </app-shell>
  `
})
class AppComponent {
  content: string;

  ngOnInit() {
    this.http.get('/api/app-content')
      .map(resp => resp.json())
      .subscribe(data => {
        this.content = data.template; // HTML as string
      });
  }
}

When I use innerHTML property to apply my HTML to <app-content>, standard HTML elements work well, but any directives/components don't work.

I want to load a template which contains ng2 directives/components.

@zoechi
Copy link
Contributor

zoechi commented May 23, 2016

Looks like a dup of #7596

@lacolaco
Copy link
Contributor Author

@zoechi Thank you! I'll watch that issue.

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants