我想从一个控件导航到另一个网页。请在下面找到示例代码。当用户点击页面上的任何组件时,他应该导航到其他控制器。导航到网页的其他部分
示例代码:
var app = angular.module('plunker', ['ui.bootstrap']);
app.controller("TabsParentController", function($scope) {
var setAllInactive = function() {
angular.forEach($scope.workspaces, function(workspace) {
workspace.active = false;
});
};
$scope.workspaces = [{
id: 1,
name: "Tab1",
active: true
}, {
id: 2,
name: "Tab2",
active: false
}, {
id: 3,
name: "Tab3",
active: false
}];
$scope.addWorkspace = function() {
setAllInactive();
};
});
app.controller("TabsChildController", function($scope, $log) {});
function goToNextTab() {
alert("click");
}
HTML代码:
<div ng-controller="TabsParentController">
<tabset>
<tab ng-repeat="workspace in workspaces"
heading="{{workspace.name}}"
active=workspace.active>
<div ng-controller="TabsChildController">
Tab Name: <input type="text" ng-model="workspace.name"/>
</div>
<input type="button" name="clickMe" value="clickMe" onclick="goToNextTab()" class="nexttab"/>
</tab>
</tabset>
</div>