我創建與tabletop.js,handlebars.js Web應用程序,並angular.js數據消失時,URL路徑
所以數據從谷歌電子表格的讀取和路由 採用了棱角分明,但是當路線後,另一頁,回來的數據就會消失
有人可以給一個解決方案請,我已經嘗試過搜索,但沒有運氣尚未:/
桌面控制器
個var public_spreadsheet_url = 'https://docs.google.com/spreadsheet/pub?hl=en_US&hl=en_US&key=0AkLy8qCw6J5EdGlmeFZEVVVZZ3ZUSEhYcjhEdEZKelE&output=html'; $(document).ready(function() { Tabletop.init({ key: public_spreadsheet_url, callback: showInfo, parseNumbers: true }); }); function showInfo(data, tabletop) { var source = $("#cat-template").html(); var template = Handlebars.compile(source); $.each(tabletop.sheets("Cats").all(), function(i, cat) { var html = template(cat); $("#content").append(html); }); }
而這些角度腳本
var routeApp = angular.module('routeApp', []);
routeApp.filter('range', function() {
return function(input, total) {
total = parseInt(total);
for (var i=0; i<total; i++) {
input.push(i);
}
return input;
};
});
routeApp.config(function($routeProvider, $locationProvider) {
$routeProvider.
when('/home', { controller: HomeCtrl, templateUrl: 'partials/home.html' }).
when('/movie/:id', { controller: BlogDetailCtrl, templateUrl: 'partials/movieDetail.html' }).
when('/product', { controller: ProductCtrl, templateUrl: 'partials/product.html' }).
otherwise({ redirectTo: '/home' });
$locationProvider.html5Mode(false);
});
function MainCtrl($scope) {
$scope.navs = [
{ text: 'Products', href: '#/product' },
];
}
function HomeCtrl($scope) {
console.log($scope);
}
function BlogDetailCtrl($scope, $routeParams) {
$scope.id = $routeParams.id;
$scope.youAreClick = function(what) {
alert('You are click on ' + what);
}
}
function ProductCtrl($scope) {
$scope.items = [
{ grid: 3.5, filename: '360x270' },
{ grid: 3.5, filename: '260x120' },
{ grid: 3, filename: '160x120' },
{ grid: 3, filename: '260x120' },
{ grid: 3, filename: '260x120' }
];
}
你能提供你的控制器代碼嗎? – BKM
@BKM主題更新:) – DarKneT