2
0
Fork 0
es5-ff-spa-loader/example/app_server/www_static/js/controller/page-foo.js

42 lines
1.1 KiB
JavaScript

pageRouteInit.push(function ($routeProvider, $locationProvider) {
var tpl = '<div><h2>Foo</h2><p>Welcome to the foo.</p></div>';
tpl += '<input type=\"button\" class=\"btn btn-default\" ng-click=\"doReload()\" value=\"Reload\"></input>';
tpl += '<input type=\"button\" class=\"btn btn-default\" ng-click=\"doClearServerUrl()\" value=\"Clear Server Url\"></input>';
tpl += '<input type=\"button\" class=\"btn btn-default\" ng-click=\"doClearCache()\" value=\"Clear Cache\"></input>';
tpl += '<p>{{message}}</p>';
$routeProvider.when('/example-ui/foo', {
template: tpl,
controller: PageFoo
});
});
function PageFoo($scope) {
$scope.message = '';
$scope.doReload = function () {
window.location.reload(true);
};
$scope.doClearServerUrl = function () {
FFSpaLoader.clearServerUrl(function(err) {
if (err) {
$scope.message = 'Error: '+err;
} else {
$scope.message = 'Cleared server url';
}
$scope.$apply();
});
};
$scope.doClearCache = function () {
FFSpaLoader.clearCache(function(err) {
if (err) {
$scope.message = 'Error: '+err;
} else {
$scope.message = 'Cleared cache';
}
$scope.$apply();
});
};
}