I would just like to know how to display AngularJS in Angular 2+ (I have a very unique situation that requires this)
So far this is what I have tried:
https://stackblitz.com/edit/angular-wbbzbz?file=src/app/app.component.ts
To give you an idea of what is happening on stackblitz:
I have a basic html string (which I got from here: https://www.w3schools.com/angular/tryit.asp?filename=try_ng_default ):
myHtml = `
<!DOCTYPE html>
<html>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js"></script>
<body>
<div ng-app="">
<p>Input something in the input box:</p>
<p>Name : <input type="text" ng-model="name" placeholder="Enter name here"></p>
<h1>Hello {{name}}</h1>
</div>
</body>
</html>
`;
And through a pipe, I display it using:
<div [innerHTML]="myHtml | pipeSanitizeHtml"></div>
But I end up having this (broken AngularJS):
如果将其放在Angular 2+ index.html
的标头中,则AngularJS将起作用:
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js"></script>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.