本文整理汇总了TypeScript中angular2-universal.queryParamsToBoolean函数的典型用法代码示例。如果您正苦于以下问题:TypeScript queryParamsToBoolean函数的具体用法?TypeScript queryParamsToBoolean怎么用?TypeScript queryParamsToBoolean使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了queryParamsToBoolean函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: ngTodo
.get(function ngTodo(req, res) {
let queryParams: any = queryParamsToBoolean(req.query);
let options = Object.assign(queryParams , {
// client url for systemjs
buildClientScripts: true,
systemjs: {
componentUrl: 'examples/src/universal/falcor_todo/client',
map: {
'angular2-universal': 'node_modules/angular2-universal',
'@angular': 'node_modules/@angular'
},
packages: PACKAGES
},
directives: [todoApp.TodoApp],
providers: [
// NODE_HTTP_PROVIDERS,
// NODE_ROUTER_PROVIDERS,
// provide(REQUEST_URL, {useExisting: req.originalUrl}),
],
data: {},
preboot: queryParams.preboot === false ? null : {debug: true, uglify: false}
});
res.render('src/universal/falcor_todo/index', options);
});
示例2: ngRouter
function ngRouter(req, res) {
let baseUrl = '/examples/router';
let url = req.originalUrl.replace(baseUrl, '') || '/';
let queryParams: any = queryParamsToBoolean(req.query);
let options: BootloaderConfig = Object.assign(queryParams , {
// client url for systemjs
buildClientScripts: true,
systemjs: {
componentUrl: 'examples/src/universal/test_router/browser',
map: {
'angular2-universal': 'node_modules/angular2-universal',
'@angular': 'node_modules/@angular'
},
packages: PACKAGES
},
// ensure that we test only server routes
client: false,
directives: [routerApp.App],
providers: [
// NODE_HTTP_PROVIDERS,
provide(BASE_URL, {useValue: baseUrl}),
provide(REQUEST_URL, {useValue: url}),
NODE_ROUTER_PROVIDERS,
],
data: {},
preboot: queryParams.preboot === false ? null : {debug: true, uglify: false}
});
res.render('src/universal/test_router/index', options);
}
示例3: ngJsonp
.get(function ngJsonp(req, res) {
let queryParams: any = queryParamsToBoolean(req.query);
let options: BootloaderConfig = Object.assign(queryParams , {
// client url for systemjs
buildClientScripts: true,
systemjs: {
componentUrl: 'examples/src/universal/test_jsonp/browser',
map: {
'angular2-universal': 'node_modules/angular2-universal',
'@angular': 'node_modules/@angular'
},
packages: PACKAGES
},
directives: [htmlApp.Html],
platformProviders: [
provide(ORIGIN_URL, {useValue: 'http://localhost:3000'}),
provide(BASE_URL, {useValue: '/examples/jsonp'})
],
providers: [
provide(REQUEST_URL, {useValue: req.originalUrl}),
NODE_PLATFORM_PIPES,
NODE_ROUTER_PROVIDERS,
NODE_JSONP_PROVIDERS,
provide(LocationStrategy, { useClass: HashLocationStrategy })
],
data: {},
preboot: queryParams.preboot === false ? null : {debug: true, uglify: false}
});
res.render('src/universal/test_jsonp/index', options);
});
示例4: queryParamsToBoolean
handler: (request, reply) => {
let queryParams = queryParamsToBoolean(request.query);
let options = Object.assign(queryParams, {
// client url for systemjs
buildClientScripts: true,
componentUrl: 'examples/app/universal/test_page/browser',
directives: [appPage.App],
providers: [
// HTTP_PROVIDERS,
// SERVER_LOCATION_PROVIDERS,
// provide(BASE_URL, {useExisting: req.originalUrl}),
// provide(PRIME_CACHE, {useExisting: true})
],
data: {},
preboot: queryParams.preboot === false ? null : {
start: true,
appRoot: 'app', // selector for root element
freeze: 'spinner', // show spinner w button click & freeze page
replay: 'rerender', // rerender replay strategy
buffer: true, // client app will write to hidden div until bootstrap complete
debug: false,
uglify: true,
presets: ['keyPress', 'buttonPress', 'focus']
}
});
reply.view('app/universal/test_page/index', options);
}
示例5: ngHtml
.get(function ngHtml(req, res) {
let queryParams: any = queryParamsToBoolean(req.query);
let options: BootloaderConfig = Object.assign(queryParams , {
// client url for systemjs
directives: [htmlApp.Html],
platformProviders: [
provide(ORIGIN_URL, {useValue: 'http://localhost:3000'}),
provide(BASE_URL, {useValue: '/'})
],
providers: [
provide(REQUEST_URL, {useValue: req.originalUrl}),
NODE_PLATFORM_PIPES,
NODE_ROUTER_PROVIDERS,
NODE_HTTP_PROVIDERS,
provide(LocationStrategy, { useClass: HashLocationStrategy })
],
data: {},
preboot: false // queryParams.preboot === false ? null : {debug: true, uglify: false}
});
res.render('src/universal/html/index', options);
});
示例6: ngApp
/**
* Render Angular 2 Application
* @param req
* @param res
*/
function ngApp(req, res) {
let baseUrl = '/';
let url = req.originalUrl || '/';
let queryParams = queryParamsToBoolean(req.query);
let options: BootloaderConfig = Object.assign(queryParams, {
async: true,
buildClientScripts: false,
data: {},
directives: [HTMLComponent],
ngOnRendered: () => {
console.log('DONE');
},
preboot: false,
providers: [
provide(ORIGIN_URL, {useValue: 'http://localhost:3000'}),
provide(BASE_URL, {useValue: baseUrl}),
provide(REQUEST_URL, {useValue: url}),
ROUTER_PROVIDERS,
NODE_PLATFORM_PIPES,
NODE_ROUTER_PROVIDERS,
NODE_HTTP_PROVIDERS
]
});
res.render('index', options);
}
示例7: ngApp
.get(function ngApp(req, res) {
let queryParams: any = queryParamsToBoolean(req.query);
let options: BootloaderConfig = Object.assign(queryParams, {
// client url for systemjs
buildClientScripts: true,
// directives: [appPage.App],
directives: [appPage.App, appPage.MyApp],
platformProviders: [
provide(ORIGIN_URL, {useValue: 'http://localhost:3000'}),
provide(BASE_URL, {useValue: '/'}),
],
providers: [
provide(REQUEST_URL, {useValue: req.originalUrl}),
...NODE_PLATFORM_PIPES,
...NODE_ROUTER_PROVIDERS,
...NODE_HTTP_PROVIDERS,
],
data: {},
systemjs: {
componentUrl: 'examples/src/universal/test_page/browser',
map: {
'angular2-universal': 'node_modules/angular2-universal',
'@angular': 'node_modules/@angular'
},
packages: PACKAGES,
},
async: queryParams.async === false ? false : true,
beautify: queryParams.beautify === false ? false : true,
preboot: queryParams.preboot === false ? null : {
appRoot: 'app', // we need to manually include the root
start: true,
freeze: 'spinner', // show spinner w button click & freeze page
replay: 'rerender', // rerender replay strategy
buffer: true, // client app will write to hidden div until bootstrap complete
debug: false,
uglify: true,
presets: ['keyPress', 'buttonPress', 'focus']
},
ngOnRendered: () => {
console.log('DONE\n');
},
ngDoCheck: () => {
// return true;
}
});
res.render('src/universal/test_page/index', options);
});
示例8: ngTemplateUrl
.get(function ngTemplateUrl(req, res) {
let queryParams: any = queryParamsToBoolean(req.query);
let options: BootloaderConfig = Object.assign(queryParams , {
// client url for systemjs
buildClientScripts: true,
systemjs: {
componentUrl: 'examples/src/universal/template_url/browser',
map: {
'angular2-universal': 'node_modules/angular2-universal'
},
packages: {
'angular2-universal/polyfills': {
format: 'cjs',
main: 'dist/polyfills',
defaultExtension: 'js'
},
'angular2-universal': {
format: 'cjs',
main: 'dist/browser/index',
defaultExtension: 'js'
}
}
},
// ngOnStable: () => {
// return new Promise(resolve => {
// setTimeout(() => {
// resolve();
// }, 500);
// });
// },
directives: [templateUrlApp.App],
platformProviders: [
provide(ORIGIN_URL, {useValue: 'http://localhost:3000'}),
provide(BASE_URL, {useValue: '/examples/template_url'}),
],
providers: [
provide(REQUEST_URL, {useValue: req.originalUrl}),
],
data: {},
async: queryParams.async === false ? false : true,
preboot: queryParams.preboot === false ? null : {debug: true, uglify: false}
});
res.render('src/universal/template_url/index', options);
});