我在主页上遵循 angular 通用:https : //angular.io/guide/universal
没有通用,我用命令运行我的 angular 项目
ng serve --ssl true --ssl-key /node_modules/browser-sync/lib/server/certs/server.key --ssl-cert /node_modules/browser-sync/lib/server/certs/server.crt --主机 0.0.0.0
现在,我将通用添加到我的项目中,但不知道如何设置它使用“https”运行。
请帮帮我。
这是我的 server.ts
导入 'zone.js/dist/zone-node'; 从“@angular/core”导入{enableProdMode};
// Express Engine
import {ngExpressEngine} from '@nguniversal/express-engine';
// 为延迟加载导入模块映射 import {provideModuleMap} from '@nguniversal/module-map-ngfactory-loader';
import * as express from 'express';
从“路径”导入 {join};
// 在 Prod 模式下更快的服务器渲染(从不需要开发模式)
enableProdMode();
// Express 服务器
const app = express();
const PORT = process.env.PORT || 4000;
const DIST_FOLDER = join(process.cwd(), 'dist/browser');
// * 笔记 ::
const {AppServerModuleNgFactory, LAZY_MODULE_MAP} = require('./dist/server/main');
// …
我在Winform应用程序中有一个网格(FlexGrid,来自ComponentOne),我试图在该网格中找到一个单元格,给定单元格的列索引及其值.
我已经编写了下面的扩展方法来遍历网格并找到该单元格.
我正在一个有6列64行的网格上测试该方法.我的代码花了10分钟才找到正确的单元格(位于最后一行)
有什么方法可以加快我的算法速度吗?
注意:我也尝试将PlayBack.PlayBackSetting.SmartMatchOption设置为TopLevelWindow,但它似乎没有改变任何东西......
谢谢!
public static WinCell FindCellByColumnAndValue(this WinTable table, int colIndex, string strCellValue)
{
int count = table.GetChildren().Count;
for (int rowIndex = 0; rowIndex < count; rowIndex++)
{
WinRow row = new WinRow(table);
WinCell cell = new WinCell(row);
row.SearchProperties.Add(WinRow.PropertyNames.RowIndex, rowIndex.ToString());
cell.SearchProperties.Add(WinCell.PropertyNames.ColumnIndex, colIndex.ToString());
cell.SearchProperties.Add(WinCell.PropertyNames.Value, strCellValue);
if (cell.Exists)
return cell;
}
return new WinCell();
}
Run Code Online (Sandbox Code Playgroud)
编辑
我将我的方法修改为如下(例如我不再使用winrow),这似乎快了大约3倍.虽然它仍然需要7秒才能找到一个包含3行和6列的表中的单元格,所以它仍然很慢......
我会将这个答案标记为后来被接受,以便留出时间让其他人提出更好的建议
public static WinCell FindCellByColumnAndValue(this WinTable table, int colIndex, string strCellValue, bool searchHeader = false)
{
Playback.PlaybackSettings.SmartMatchOptions = Microsoft.VisualStudio.TestTools.UITest.Extension.SmartMatchOptions.None;
int count = …Run Code Online (Sandbox Code Playgroud) 我可能会遗漏一些东西,但是如何使用ExtJS(v 3)以编程方式检查radiobutton?
以下似乎并不总是有效
var radio = Ext.get("myradiobutton");
radio.set( "检查",");
收音机有时会被检查,有时候不会......
radio.is(":checked")有时会返回true,有时会返回false
谢谢
我们有一个定义组件的核心模块,以及一个继承该核心模块的子模块(在单个应用程序内)。子模块包含从核心组件继承的子组件。
核心模块中的每个组件都通过sass导入来导入变量。我希望子组件使用不同的不同的sass变量,但不必重新定义所有的css规则。
我该如何实现?
注意:如果每个子模块都在单独的应用程序中,那么我已经找到了解决方案。使用.angular-cli.json中的“ stylePreprocessorOptions”配置(针对每个应用程序定义),我能够使用文件名而不是文件相对路径在核心组件中导入变量。这样,每个子组件都可以使用正确的变量文件,而无需执行任何操作。但是我不想使用多个应用程序,因为我们将有40个应用程序...
谢谢
I'm trying to create an ICS file to add events to a Google calendar via email. In the end, the calendar will be sent to multiple users, from a desktop app. Ideally I'd like to be able to modify the calendar if the events change (just event times, I'm ignoring cancelled events)
Here is my ICS file
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//MY COMPANY//Calendar//EN
CALSCALE:GREGORIAN
METHOD:PUBLISH
BEGIN:VEVENT
UID:shift-439-emp-128@mycompany.com
DTSTART:20180604T090000
DTEND:20180604T153000
DTSTAMP:20180519T081800
SUMMARY:Morning shfit
LOCATION:Morning Location
DESCRIPTION:Morning shift
END:VEVENT
BEGIN:VEVENT
UID:shift-446-emp-128@mycompany.com
DTSTART:20180605T153000
DTEND:20180605T233000
DTSTAMP:20180519T081800 …Run Code Online (Sandbox Code Playgroud) app.listen(PORT, () => {
console.log("process.env.NODE_ENV", process.env.NODE_ENV);
console.log(`Node server listening on http://localhost:${PORT}`);
});
Run Code Online (Sandbox Code Playgroud)
我在控制台中收到 process.env.NODE_ENV 'none'
构建命令
npm run build:alpha:ssr NODE_ENV=alpha
Run Code Online (Sandbox Code Playgroud)
我的 package.json 文件
{
"name": "mobilesite-ecommerce",
"version": "0.0.0",
"license": "MIT",
"scripts": {
"ng": "ng",
"start": "ng serve -c local",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e",
"build:ssr": "npm run build:client-and-server-bundles && npm run webpack:server",
"serve:ssr": "node dist/server",
"build:client-and-server-bundles": "ng build --prod --deploy-url=##scripturl## && ng run mobilesite-ecommerce:server:production",
"webpack:server": "webpack --config webpack.server.config.js --progress --colors",
"build:prerender": "npm run …Run Code Online (Sandbox Code Playgroud) variables environment server-side-rendering angular-universal
我的应用程序用于APP_INITIALIZER在初始化应用程序之前从 json 文件动态检索一些配置。
当使用 Angular Universal 时,延迟加载的模块是在使用时返回的承诺APP_INITIALIZER解决之前在服务器端创建的。
当不使用角度通用时,这效果很好。这是角度通用的错误,还是我做错了什么?
应用程序模块.ts
export function loadConfigService(configService: AppConfigService): Function
{
return () => {
return configService.load();
};
}
@NgModule({
//...
providers: [
{
provide: APP_INITIALIZER,
useFactory: loadConfigService,
deps: [AppConfigService],
multi: true
},
Run Code Online (Sandbox Code Playgroud)
应用程序配置.service.ts
export class AppConfig
{
readonly apiUrl: string;
//other properties
}
export let APP_CONFIG: AppConfig;
@Injectable()
export class AppConfigService
{
constructor(private http: HttpClient, @Inject(PLATFORM_ID) private platformId: Object, @Optional() @Inject('serverUrl') protected serverUrl: string)
{
}
public load()
{
console.log('in load'); …Run Code Online (Sandbox Code Playgroud) 我已经使用 firebase 商店创建了项目。现在我想在其上实现服务器端渲染。当我运行程序时,我为 ssr 做了所有事情之后,这就是我得到的
ReferenceError: window is not defined
at Object.ex9U (C:\Users\waqas\Desktop\ng-blog\dist\ng-blog\server\main.js:166129:4)
at __webpack_require__ (C:\Users\waqas\Desktop\ng-blog\dist\ng-blog\server\main.js:26:30)
at Module.vvyD (C:\Users\waqas\Desktop\ng-blog\dist\ng-blog\server\main.js:271824:80)
at __webpack_require__ (C:\Users\waqas\Desktop\ng-blog\dist\ng-blog\server\main.js:26:30)
at Module.PCNd (C:\Users\waqas\Desktop\ng-blog\dist\ng-blog\server\main.js:131612:74)
at __webpack_require__ (C:\Users\waqas\Desktop\ng-blog\dist\ng-blog\server\main.js:26:30)
at Module.ZAI4 (C:\Users\waqas\Desktop\ng-blog\dist\ng-blog\server\main.js:154371:80)
at __webpack_require__ (C:\Users\waqas\Desktop\ng-blog\dist\ng-blog\server\main.js:26:30)
at Module.24aS (C:\Users\waqas\Desktop\ng-blog\dist\ng-blog\server\main.js:47619:69)
at __webpack_require__ (C:\Users\waqas\Desktop\ng-blog\dist\ng-blog\server\main.js:26:30)
A server error has occurred.
node exited with 1 code.
connect ECONNREFUSED 127.0.0.1:63621
Run Code Online (Sandbox Code Playgroud)
这是我的文件 package.json
{
"name": "ng-blog",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"dev:ssr": "ng run ng-blog:serve-ssr",
"serve:ssr": "node dist/ng-blog/server/main.js",
"build:ssr": "ng build …Run Code Online (Sandbox Code Playgroud) 我想要一个带有该URL的路线
/collections/:collectionId/books/:bookId/:title
Run Code Online (Sandbox Code Playgroud)
例如
/collections/10/books/456678/my-book.html
Run Code Online (Sandbox Code Playgroud)
在我的app-routing.module.ts文件中
{path: 'collections/:collectionId/books/:bookId/:title', component: BookDetailsComponent},
Run Code Online (Sandbox Code Playgroud)
是否可以不使用嵌套的路由器插座?
我试过了
this.router.navigate(['/collections',{collectionId: 10, bookId: 456678, title: "my-book.html"}]);
Run Code Online (Sandbox Code Playgroud)
但得到了一个错误
Cannot match any routes. URL Segment: 'collections;collectionId=10;bookId=456678;title=my-book.html'
Run Code Online (Sandbox Code Playgroud)
如果我将参数作为数组传递,
this.router.navigate(['/collections', 10, 456678, "my-book.html"]);
Run Code Online (Sandbox Code Playgroud)
我明白了
Error: Cannot match any routes. URL Segment: 'collections/10/456678/my-book.html
Run Code Online (Sandbox Code Playgroud)
我设法在"收藏"路线下使用"书籍"儿童路线实现我想要的东西,但我想在没有嵌套路线的情况下做到这一点.
谢谢
语境
我想创建一个地图组件,并希望在各种URL上重复使用。实例化该组件非常耗时,并且每次创建该组件时也会用尽图块请求来显示地图图像。
题
当组件嵌套在树中时,如何在不同的URL上重复使用同一组件实例?
在下面的堆栈闪电中,ReusableComponent每次切换路线时都会实例化一个新的
https://stackblitz.com/edit/angular-sr9stk?file=app%2Freusable.component.ts
注意
我知道RouteReuseStrategy,但这仅适用于顶级组件(即,路由设置中定义的组件)
使用角度5.2
angular ×6
angular-cli ×1
angular7 ×1
c# ×1
email ×1
environment ×1
extjs ×1
icalendar ×1
inheritance ×1
javascript ×1
performance ×1
radio-button ×1
sass ×1
typescript ×1
variables ×1
winforms ×1