angularjs: ng-click on 不起作用,工作
这 Javascript
我的代码是takov
路由配置如下。
当我点击
, 这会让我引起
当我更改代码时
在
, 他工作,我在这里做错了什么?
</button></a>
function gotoUrl/$scope, $location, $http, $window/ {
$scope.setRoute = function /route/ {
$location.path/route/;
};
我的代码是takov
<ul class="nav navbar-nav navbar">
<li><a data-ng-click="setRoute/'summary'/" href="#"><span class="icon-bar-chart"></span> Summary</a></li>
<li><a data-ng-click="setRoute/'transactions'/" href="#
"><span class="icon-reorder"></span>
Transactions</a></li>
<li><a data-ng-click="setRoute/'budgets'/" href="#"><span class="icon-calendar"></span>
Budgets</a></li>
</ul>
路由配置如下。
app.config/function /$routeProvider/ {
$routeProvider
.when/'/summary', {templateUrl: '../static/partials/summary.html', controller: 'SummaryController'}/
.when/'/transactions', { templateUrl: '../static/partials/listTransaction.html', controller: 'TransactionsManagerController'}/
.when/'/profile', {templateUrl: '../static/partials/profile.html', controller: 'ProfileController'}/
.when/'/new', {templateUrl: '../static/partials/addTransaction.html', controller: 'TransactionAddController'}/
.when/'/budgets', {templateUrl: '../static/partials/budgets.html'}/
.otherwise/{redirectTo: '/summary'}/;
}/;
当我点击
Transactions
, 这会让我引起
Summary
当我更改代码时
<a>
在
<button>
, 他工作,我在这里做错了什么?
</button></a>
没有找到相关结果
已邀请:
4 个回复
郭文康
赞同来自:
更改标记的行为 html A 默认为这样的方式
防止默认操作
当归因时 href 空的
.
涵秋
赞同来自:
反而
. 如果您在模式下使用路由 hashbang, 然后后者会完全重新启动页面,似乎正在发生这种情况。 任何参考文献S.
, 您单击的内容,使您的应用程序完全重新载入此页面并下载默认路由 - 在你的情况下
.
冰洋
赞同来自:
AngularJS 确保 rest.
涵秋
赞同来自:
到