从函数打开新选项卡后,每次在新选项卡上单击<a>都会调用打开新选项卡的函数吗?

时间:2019-11-23 09:27:37

标签: javascript angularjs angularjs-directive angular-ui-router

this call stack from the new tab that invokes the function from a parent tab this the first click that open new tab call stack

我有一个可以打开新标签页的元素

<a href="#" ng-click="ordersCtrl.goToDetailsNewTab(row, $event)">{{row.id}}</a>
vm.goToDetailsNewTab = function(row, $event) {
  if ($event && 'preventDefault' in $event) {
    $event.stopPropagation();
    $event.preventDefault();
  }

  vm.row.select(row);

  var url = $state.href('app.orders.details', {
    id: row.id,
    breadCrumbs: row.id
  }, {  inherit: false });

  window.open(url, '_blank');
};

我的问题是,当我单击新选项卡上的<a>标签时,它还会触发父选项卡上的goToDetailsNewTab功能。为什么会这样?

0 个答案:

没有答案