我在表行上有一个单击事件,在这一行中还有一个带有单击事件的删除按钮.当我单击删除按钮时,也会触发行上的单击事件.
这是我的代码.
<tbody>
<tr ng-repeat="user in users" class="repeat-animation" ng-click="showUser(user, $index)">
<td>{{user.firstname}}</td>
<td>{{user.lastname}}</td>
<td>{{user.email}}</td>
<td><button class="btn red btn-sm" ng-click="deleteUser(user.id, $index)">Delete</button></td>
</tr>
</tbody>
Run Code Online (Sandbox Code Playgroud)
showUser
当我单击表格单元格中的删除按钮时,如何防止触发事件?
如果用户在模态中单击"确定",我想将用户路由到网址.在我的控制器中,我收到的网址就像
var newUrl = http://localhost:3000/#/dashboard
var newUrl = http://localhost:3000/#/users
Run Code Online (Sandbox Code Playgroud)
作为变量.
如果我然后使用
$location.path(newUrl);
Run Code Online (Sandbox Code Playgroud)
这是行不通的.我也试过了
$location.url(newUrl);
Run Code Online (Sandbox Code Playgroud)
但是我的URL被编码为这样.
http://localhost:3000/#/#%2Fdashboard
Run Code Online (Sandbox Code Playgroud)
有没有办法只获得网址的路径?
编辑
此代码是服务的一部分.用户在表单中进行一些输入并单击另一个链接,例如在菜单中.然后会出现一个弹出窗口,要求他跳过表单更改.如果他点击是,我会收到请求的网址.这是从我在服务器上的开发环境当然会是另一个url.所以我不能只使用
$location.path("/users")
Run Code Online (Sandbox Code Playgroud)
例如