Angular 8-路由模板代码导致无响应的超链接或按钮

在以下两个用例中,角度路由似乎令人困惑。下面的代码显示了合法的代码。

使用案例1:

<!-- TEMPLATE CODE -->
<div class="row col-lg">
    <button mat-raised-button class="btn btn-primary" 
        (click)="assignmentdetail(element.assignment)">
            {{element.effDate| date}}</button>
</div>

<!---  HTML OUTPUT -->

<div _ngcontent-aqb-c30="" class="row col-lg">
   <button _ngcontent-aqb-c30="" class="btn btn-primary mat-raised-button" mat-raised-button="">
      <span class="mat-button-wrapper">May 6,2019</span>
      <div class="mat-button-ripple mat-ripple" matripple="" ng-reflect-centered="false" 
        ng-reflect-disabled="false" ng-reflect-trigger="[object HTMLButtonElement]"></div>
      <div class="mat-button-focus-overlay"></div>
   </button>
</div>

<!-- THE PROBLEM STATEMENT-->
Clicking the button does not call the event function. The button is not disabled.

使用案例2:

<!-- TEMPLATE CODE -->
<div class="row col-lg">
    <a [routerLink]="['details',element.assignment.assignmentId]">
        {{element.effDate| date}}</a>
</div>

<!-- HTML OUTPUT -->
<div _ngcontent-aqb-c30="" class="row col-lg">
    <a _ngcontent-aqb-c30="" ng-reflect-router-link="details,15561" 
        href="/assignment/10/00035960/history/details/15561">May 6,2019</a>
</div>

<!-- PROBLEM STATEMENT -->
Although the hyperlink is active but clicking on it does not route to the path,there's nothing on the VS code debug console
wdjylove 回答:Angular 8-路由模板代码导致无响应的超链接或按钮

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3164621.html

大家都在问