Added mobile example app
This commit is contained in:
parent
4fbf705ae5
commit
cf364fc418
26 changed files with 187 additions and 61 deletions
10
example/app_server/www_static/js/controller/page-bar.js
Normal file
10
example/app_server/www_static/js/controller/page-bar.js
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
|
||||
pageRouteInit.push(function ($routeProvider, $locationProvider) {
|
||||
$routeProvider.when('/example-ui/bar', {
|
||||
templateUrl: window.serverUrl+'/example-ui/thtml/bar',
|
||||
controller: PageFoo
|
||||
});
|
||||
});
|
||||
|
||||
function PageFoo($scope, $http) {
|
||||
}
|
||||
42
example/app_server/www_static/js/controller/page-foo.js
Normal file
42
example/app_server/www_static/js/controller/page-foo.js
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
|
||||
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>';
|
||||
|
||||
pageRouteInit.push(function ($routeProvider, $locationProvider) {
|
||||
$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();
|
||||
});
|
||||
};
|
||||
}
|
||||
10
example/app_server/www_static/js/controller/page-index.js
Normal file
10
example/app_server/www_static/js/controller/page-index.js
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
|
||||
pageRouteInit.push(function ($routeProvider, $locationProvider) {
|
||||
$routeProvider.when('/example-ui', {
|
||||
template: '<div><h2>Example UI Index</h2><p>Welcome make yourself at home.</p></div>',
|
||||
controller: PageIndex
|
||||
});
|
||||
});
|
||||
|
||||
function PageIndex($scope, $http) {
|
||||
}
|
||||
27
example/app_server/www_static/js/example-app.js
Normal file
27
example/app_server/www_static/js/example-app.js
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
'use strict';
|
||||
document.title = 'FFSpaLoader Example';
|
||||
|
||||
var serverUrl = window.FFServerUrl;
|
||||
console.log('FFExample provided serverUrl \"'+serverUrl+'\"');
|
||||
|
||||
$(document.createElement('div')).attr('id', 'wrapper').appendTo($('body'));
|
||||
$(document.createElement('div')).attr('ng-controller', 'ApplicationController').attr('ng-include', '\''+serverUrl+'/example-ui/thtml/header\'').appendTo($('#wrapper'));
|
||||
$(document.createElement('div')).attr('id', 'page-wrapper').appendTo($('#wrapper'));
|
||||
$(document.createElement('div')).attr('id', 'container-fluid').attr('ng-view', '').appendTo($('#page-wrapper'));
|
||||
$(document.createElement('div')).attr('ng-include', '\''+serverUrl+'/example-ui/thtml/footer\'').appendTo($('body'));
|
||||
|
||||
var pageRouteInit = [];
|
||||
var exampleUI = angular.module('exampleUI', ['ngRoute']).config(
|
||||
['$routeProvider','$locationProvider','$sceDelegateProvider', function
|
||||
($routeProvider , $locationProvider , $sceDelegateProvider) {
|
||||
pageRouteInit.forEach(function(init) { init($routeProvider, $locationProvider); });
|
||||
$sceDelegateProvider.resourceUrlWhitelist(['self',serverUrl+'/**']);
|
||||
$routeProvider.otherwise({ redirectTo: '/example-ui' });
|
||||
$locationProvider.html5Mode({requireBase: false});
|
||||
}]);
|
||||
|
||||
exampleUI.controller('ApplicationController',function($scope,$http,$location) {
|
||||
$scope.goLink = function ( path ) {
|
||||
$location.path( path );
|
||||
};
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue