AngularJS ng-click无法正常工作

时间:2018-11-19 15:29:03

标签: angularjs

AngularJS中的

ng-click无法正常工作。
即使单击NewsLetter2,也会警告其显示newsletter。我希望看到newsletter2

<table class="table">
  <tr>
    <td>
      <span class="glyphicon glyphicon-file text-info"></span>
      <a ng-click="ShowYouthandYoungContent('Newsletters')">Newsletters</a>
    </td>
  </tr>
  <tr>
    <td>
      <span class="glyphicon glyphicon-file text-info"></span>
      <a ng-click="ShowYouthandYoungContent('Newsletters2')">Newsletters 2</a>
    </td>
  </tr>
</table>

下面是JS,我有什么想念的吗

$scope.ShowYouthandYoungContent = function(link) {
  if (link === "Newsletters") {
    alert("Newsletters")
  } else if (link === "Newsletters2") {
    alert("Newsletters2");
  }
}

0 个答案:

没有答案