0
我是angularJS的新手,尝试创建一个简单的应用程序。当我点击一个按钮,比如index.html页面,我想转到.search.html页面时,我遇到了问题。angularJS - 简单的按钮导航页面
这里是我的index.html的按钮:
<body ng-controller="mainController">
<button ng-click="GoToNext2('/search')">Search</button>
</body>
这里是我的角度代码:
// create the module and name it scotchApp
var scotchApp = angular.module('scotchApp', ['ngRoute']);
// configure our routes
scotchApp.config(function($routeProvider) {
$routeProvider
// route for the home page
.when('/', {
templateUrl : 'home.html',
controller : 'mainController'
})
.when('/search', {
templateUrl : 'Search.html',
controller : 'searchController'
});
});
// create the controller and inject Angular's $scope
scotchApp.controller('searchController', function($scope) {
$location.path(hash);
});
我要调用一个函数(执行当我点击过搜索)
谢谢
你到目前为止尝试了什么?首先要在你的控制器中实现你的'goToNext()'方法。 – muenchdo
可能的重复[是否有一个简单的方法来使用按钮导航页面作为链接在angularjs中执行](http://stackoverflow.com/questions/15847726/is-there-a-simple-way-to-use-按钮浏览的页面,作为一种链路确实功能于angularjs) –