'use strict'; document.title = 'FFSpaLoader Example'; var serverUrl = window.FFServerUrl; console.log('FFExample provided serverUrl \"'+serverUrl+'\"'); // TODO for 0.4.0 //var tplCache = FFSpaLoader.factory.cache.websql({table: 'angular_tpl'}); //tplCache.cacheOpen(function(err) { // tplCache.cacheSetValue('key123','value456',function(err) { // console.log('FFExample local value cached'); // }); //}); var moduleTpl = angular.module('app-tpl', []); moduleTpl.run(["$templateCache", function($templateCache) { var tpl = ''; tpl += '\n'; $templateCache.put('/example-ui/thtml/header', tpl); $templateCache.put('/example-ui/thtml/footer', '\n'); }]); $(document.createElement('div')).attr('id', 'wrapper').appendTo($('body')); $(document.createElement('div')).attr('ng-controller', 'ApplicationController').attr('ng-include', '\'/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', '\'/example-ui/thtml/footer\'').appendTo($('body')); var pageRouteInit = []; var exampleUI = angular.module('exampleUI', ['app-tpl','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 ); }; });