我正在使用 angular 5,以前我们在 angular js 中有项目,现在我们将其更改为 angular 5。
我正在使用已经存在的 WebAPI 响应,
用于显示动态操作菜单,作为回应:我得到了一些锚标记,例如
<a href="#" title="Recommend to" onclick="\"fnShowMyRecommendedUsers('http://localhost:4200/MyReCommendedUsersParams/true/Contentid/34cac8bf-01a8-49d3-9251-a39eb94e2563/userid/1')\"">Recommend to</a>
和javascript函数一样
javascript:fnAddItemtoMyLearning('ab63ea41-5eb6-4860-b477-cc50a70af5ba');
所以,我使用 DomSanitizer
我尝试如下
app.component.html
[innerHtml]="course.ViewLink | safe:'html'" - showing html script in front end
href={{course.ViewLink | safe:'script'}} -- showing the action link but action is not working
ng-click="course.ViewLink | safe: 'script'" -- showing the action link noting happening
(click)="course.ViewLink | safe: 'script'" -- showing error
我想像 somefunction() 一样调用 app.component.ts 中的方法。
需要帮助,谢谢。