Javascript 使用ng view时浏览器后退按钮未加载正确的内容(前端为angular js;后端为node+;express)
最初,当我使用/home.html时,我可以看到home.html成功地进入index.html,然后单击Javascript 使用ng view时浏览器后退按钮未加载正确的内容(前端为angular js;后端为node+;express),javascript,jquery,html,angularjs,node.js,Javascript,Jquery,Html,Angularjs,Node.js,最初,当我使用/home.html时,我可以看到home.html成功地进入index.html,然后单击此处的任何帮助。。。或者,如果需要更多的解释问题,我可以帮助即使两周后没有帮助,我搜索了很多但无法找出:(这里有任何帮助…或者如果需要更多的解释问题,我可以帮助即使两周后没有帮助,我搜索了很多但无法找出:( angular.module('appRoutes', []).config(['$routeProvider', function($routeProvider) {
此处的任何帮助。。。或者,如果需要更多的解释问题,我可以帮助即使两周后没有帮助,我搜索了很多但无法找出:(这里有任何帮助…或者如果需要更多的解释问题,我可以帮助即使两周后没有帮助,我搜索了很多但无法找出:(
angular.module('appRoutes', []).config(['$routeProvider', function($routeProvider) {
$routeProvider
// home page
.when('/', {
templateUrl: 'views/home.html',
controller: 'MainController'
})
// nerds page that will use the NerdController
.when('/club', {
templateUrl: 'views/club.html',
controller: 'ClubController'
});
}]);
angular.module('ClubCtrl', []).controller('ClubController', [ '$http','Club', function($http, Club) {
var club = this;
club.data = {};
Club.getClubData().then(function(response){
club.data = response.data;
});
}]);
angular.module('ClubService', []).factory('Club', ['$http', function($http) {
return {
getClubData : function() {
return $http.get('/api/club');
}
};
}]);
module.exports = function(app) {
app.get('/', function(req, res) {
console.log("routes send get(*)");
res.sendFile(path.resolve('public/index.html')); // load our public/index.html file
});
app.get('/api/club', function(req, res){
console.log("routes send get /club");
con.query("select * from club_data", function(err, rows,field) {
if (!err)
{
console.log('The solution is: ', rows);
res.json(rows);
}
else
console.log('Error while performing Query. ', err);
});
});
};
</div>
<div class="row " >
<div class="col-md-3 col-sm-6 image-feature" ng-repeat='dat in main.data'>
<div class="thumbnail">
<img ng-src="images/club/{{dat.imagename}}"alt="">
<div class="caption">
<h3>{{ dat.name }}</h3>
<p>{{dat.desccription}}</p>
<p>{{dat.date}}</p>
<p>
<a href="#" class="btn btn-primary">I'm Going!</a>
</p>
</div>
</div>
</div>
<h1>Party</h1>
<div class="divider"></div>
<p>"Anytime I'm at a club or a party, I'm dancing from beginning to end."<br>--Agnes Bruckner</p>
</div>
<div class="row">
<div class="col-md-3 col-sm-3 col-xs-6">
<div class="about-item scrollpoint sp-effect2">
<a href="#/club" style="text-decoration:none"></a>
<body ng-app="staygala" ng-controller="MainController">
<!-- ANGULAR DYNAMIC CONTENT -->
<div ng-view></div>
</body>
angular.module('staygala', ['ngRoute', 'appRoutes', 'MainCtrl', 'ClubCtrl', 'ClubService']);