Private/Angular/Component/Crud/New-NgCrudComponent.ps1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
<############################################################################ ############################################################################> Function New-NgCrudComponentPrivate([WebCsprojInfo]$webCsprojInfo, [TableInfo]$tableInfo) { [string]$angularCrudComponentTsFileName = "$($webCsprojInfo.angularComponentDir)\$($tableInfo.tableLowerKebab).component.ts" Write-Output "### Add component $($tableInfo.tableLowerKebab)Component TypeScript to $angularCrudComponentTsFileName" New-NgCrudComponentTsToString $tableInfo "/$($tableInfo.tableLowerKebab)" | Out-FileUtf8NoBom $angularCrudComponentTsFileName [string]$angularCrudComponentHtmlFileName = "$($webCsprojInfo.angularComponentDir)\$($tableInfo.tableLowerKebab).component.html" Write-Output "### Add component $($tableInfo.tableLowerKebab)Component HTML to $angularCrudComponentHtmlFileName" New-NgCrudComponentHtmlToString $webCsprojInfo $tableInfo | Out-FileUtf8NoBom $angularCrudComponentHtmlFileName [string]$angularCrudComponentCssFileName = "$($webCsprojInfo.angularComponentDir)\$($tableInfo.tableLowerKebab).component.css" Write-Output "### Add component $($tableInfo.tableLowerKebab)Component Css to $angularCrudComponentCssFileName" New-NgCrudComponentCssToString $webCsprojInfo $tableInfo | Out-FileUtf8NoBom $angularCrudComponentCssFileName # Add import to app.module Write-Output "### Add component $($tableInfo.tableCapitalCamel)Component to app.module.ts" Edit-NgModuleAddComponent $webCsprojInfo "$($tableInfo.tableCapitalCamel)Component" "./component/$($tableInfo.tableLowerKebab).component" # Add route for edit and new Write-Output "### Add route for edit and new component $($tableInfo.tableCapitalCamel)Component to app-routing.module.ts" Edit-NgModuleAddRoute $webCsprojInfo "$($tableInfo.tableCapitalCamel)Component" "./component/$($tableInfo.tableLowerKebab).component" "$($tableInfo.tableLowerKebab)/:id" Edit-NgModuleAddRoute $webCsprojInfo "$($tableInfo.tableCapitalCamel)Component" "./component/$($tableInfo.tableLowerKebab).component" "$($tableInfo.tableLowerKebab)-new" } |