0

I want to call already registered angular component(another) from a current component file to HTML but in HTML it's reading as String.

The code below, is im trying out in component file,

$scope.component = "<complaint-create-component></complaint-create-component>;

I tried ng-bind-HTML expression to call but that also reading as String. if I use this component name (<complaint-create-component></complaint-create-component>) directly into HTML file it's working fine(As expected).

Presently I'm using angular 1.6 version.

Please help me out.

aby km
  • 11
  • 2

1 Answers1

0

Try use $sce.trustAsHtml:

$scope.component= $sce.trustAsHtml("<complaint-create-component></complaint-create-component>");
Hp Lam
  • 343
  • 1
  • 9