2
0
Fork 0
es5-ff-spa-loader/example/www_static/js/example-app.js

28 lines
1.3 KiB
JavaScript
Raw Normal View History

2015-12-23 00:16:54 +00:00
'use strict';
document.title = 'FF-Spa-Loader Example';
2016-01-14 21:42:13 +00:00
var serverUrl = window.FFServerUrl;
console.log('FF provided serverUrl: '+serverUrl);
2015-12-23 00:16:54 +00:00
$(document.createElement('div')).attr('id', 'wrapper').appendTo($('body'));
2016-01-14 23:36:10 +00:00
$(document.createElement('div')).attr('ng-controller', 'ApplicationController').attr('ng-include', '\''+serverUrl+'/example-ui/thtml/header\'').appendTo($('#wrapper'));
2015-12-23 00:16:54 +00:00
$(document.createElement('div')).attr('id', 'page-wrapper').appendTo($('#wrapper'));
$(document.createElement('div')).attr('id', 'container-fluid').attr('ng-view', '').appendTo($('#page-wrapper'));
2016-01-14 21:42:13 +00:00
$(document.createElement('div')).attr('ng-include', '\''+serverUrl+'/example-ui/thtml/footer\'').appendTo($('body'));
2015-12-23 00:16:54 +00:00
var pageRouteInit = [];
2016-01-14 23:36:10 +00:00
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});
2016-01-14 21:42:13 +00:00
}]);
2015-12-23 00:16:54 +00:00
2016-01-14 23:36:10 +00:00
exampleUI.controller('ApplicationController',function($scope,$http,$location) {
$scope.goLink = function ( path ) {
$location.path( path );
};
});