32 lines
1.5 KiB
Plaintext
32 lines
1.5 KiB
Plaintext
'use strict';
|
|
|
|
var serverUrl = window.FFServerUrl;
|
|
var crudRouteInit = [];
|
|
var pageRouteInit = [];
|
|
|
|
document.title = 'TCrud Example';
|
|
|
|
$(document.createElement('div')).attr('ng-controller', 'ApplicationController').attr('ng-include','\''+serverUrl+'/api/plugin/angular/thtml/application-top\'').appendTo($('body'));
|
|
$(document.createElement('div')).attr('ng-include','\''+serverUrl+'/api/plugin/angular/thtml/application-view\'').appendTo($('body'));
|
|
|
|
var tcrudUI = angular.module('tcrudUI', ['ngRoute','ngTouch','ngAnimate', 'ui.grid', 'ui.grid.pagination','ui.grid.cellNav', 'ui.grid.edit', 'ui.grid.resizeColumns', 'ui.grid.pinning', 'ui.grid.selection', 'ui.grid.moveColumns', 'ui.grid.exporter', 'ui.grid.importer', 'ui.grid.grouping', 'ui.grid.autoResize']).
|
|
config(['$routeProvider', '$locationProvider', '$sceDelegateProvider', function($routeProvider, $locationProvider, $sceDelegateProvider) {
|
|
|
|
console.log('config angular...');
|
|
console.log('config serverUrl: ', serverUrl);
|
|
|
|
// init routes
|
|
pageRouteInit.forEach(function(init) { init($routeProvider, $locationProvider); });
|
|
crudRouteInit.forEach(function(init) { init($routeProvider, $locationProvider); });
|
|
|
|
$sceDelegateProvider.resourceUrlWhitelist(['self',serverUrl+'/**']);
|
|
$routeProvider.otherwise({ redirectTo: '/ui' });
|
|
$locationProvider.html5Mode({requireBase: false});
|
|
|
|
console.log('config angular done.');
|
|
}]);
|
|
|
|
tcrudUI.run(['$route', function($route) {
|
|
$route.reload(); // ng-view works inside the ng-include
|
|
}]);
|