我正在 Nx monorepo 中工作,其中包含许多 Angular 15 应用程序和一些共享库。我使用 nx cli 生成了一个新的 Angular 应用程序,效果很好。我可以毫无问题地提供和构建应用程序。
当我将新应用程序的 tsconfig 文件添加到我的 eslintrc.json 文件时,问题就出现了
"overrides": [
"parserOptions": {
"project": [
"apps/new-app/tsconfig.*?.json"
"libs/shared/tsconfig.*?.json"
*/ -----
15 others
-----/*
]
}
]
Run Code Online (Sandbox Code Playgroud)
如果我将新应用程序添加到 parserOptions,然后运行
nx 受影响 --target=lint
对于尚未触及的共享库,我收到此错误
<--- Last few GCs --->
[18664:0000015D230EE780] 71334 ms: Scavenge 4044.3 (4127.2) -> 4039.4 (4128.5) MB, 12.6 / 0.0 ms (average mu = 0.835, current mu = 0.632) allocation failure
[18664:0000015D230EE780] 71386 ms: Scavenge 4047.0 (4130.1) -> 4043.9 (4131.8) MB, 14.5 / …Run Code Online (Sandbox Code Playgroud) 以上是我在 Firebase 的 Firestore 数据库中的数据结构。我可以使用以下设置成功提取数据并将其放入 ng2 智能表中:
export const userTableSettings = {
delete: {
confirmDelete: true,
deleteButtonContent: '<i class="ft-x danger font-medium-1 mr-2"></i>'
},
add: {
confirmCreate: true,
},
edit: {
confirmSave: true,
editButtonContent: '<i class="ft-edit-2 info font-medium-1 mr-2"></i>'
},
firstName: {
title: 'Full Name',
},
lastName: {
title: 'User Name',
},
email: {
title: 'Email',
},
},
attr: {
class: 'table table-responsive'
},
};
Run Code Online (Sandbox Code Playgroud)
但是当我为角色添加位置时
roles: {
title: 'Role',
},
Run Code Online (Sandbox Code Playgroud)
输出是
我希望能够显示一个或多个用户角色(如果他们有多个角色),并且能够从表中更新它们。
firebase typescript ng2-smart-table google-cloud-firestore angular5
我有一个运行 Angular 8.2 的应用程序。除默认路由外,路由运行良好。
当我去时website.com我想被重定向到website.com/sign-in
应用程序路由模块
const routes: Routes = [
{
path: '',
redirectTo: 'sign-in',
pathMatch: 'full'
},
{
path: '',
component: PublicLayoutComponent,
data: { title: 'Public Views' },
children: PUBLIC_ROUTES
},
{
path: '',
component: PrivateLayoutComponent,
data: { title: 'Private Views' },
children: PRIVATE_ROUTES
},
];
Run Code Online (Sandbox Code Playgroud)
公共路由模块
export const PUBLIC_ROUTES: Routes = [
{
path: "sign-in",
loadChildren: () =>
import('../features/sign-in/sign-in.module').then(
m => m.SignInModule
)
}
];
Run Code Online (Sandbox Code Playgroud)
私有路由模块
export const PRIVATE_ROUTES: Routes = [
{
path: …Run Code Online (Sandbox Code Playgroud) 我使用 PrimeNg 和 Angular 6 来生成一个确认框,用于从表单中删除项目,并保存对表单所做的所有更改。什么时候
delete() {
this._confirmationService.confirm({
message: 'Delete Item?',
key: 'delete',
accept: () => {
// code to delete row
}
});
}
submit() {
this._confirmationService.confirm({
message: 'Save Changes',
key: 'submit',
accept: () => {
// code to save changes
}
});
}
Run Code Online (Sandbox Code Playgroud)
html
<button pButton (click)="delete()"></button>
<button pButton (click)="submit()"></button>
<p-confirmDialog key="delete"></p-confirmDialog>
<p-confirmDialog key="submit"></p-confirmDialog>
Run Code Online (Sandbox Code Playgroud)
当不使用按键时,两个按钮都会调用提交确认功能。使用按键时,提交按钮会调用提交确认,但在接受时会陷入循环,而删除函数会调用提交确认,如果被拒绝,则会调用删除确认。
我需要做什么才能只调用特定于该功能的确认服务?
我需要将JSON对象传递给python中的单独函数
import json
userList = [{username: 'userName', email: 'email'}]
listString = json.dumps(userList)
print(json.loads(listString))
Run Code Online (Sandbox Code Playgroud)
这将打印相同的对象: [{username: 'userName', email: 'email'}]
我知道不可能将JSON对象直接传递给另一个函数,这就是为什么我将其转换为字符串并尝试在新函数中解压缩它的原因
testFunction(listString)
def testFunction(oldList):
print(json.dumps(oldList))
Run Code Online (Sandbox Code Playgroud)
这将打印出来,[{'username': 'userName', 'email': 'email'}]但不会让我从新函数中返回对象。我需要做什么来解决这个问题?
def testFunction(oldList):
newList = json.loads(oldList)
# code to append to newList
return newList
Response: null
Run Code Online (Sandbox Code Playgroud)