Private/Angular/Component/Home/New-NgHomeComponent.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
27
28
<############################################################################
 # Make angular home page with bootstrap jumbotron and a few boxes
 ############################################################################>

Function New-NgHomeComponent([WebCsprojInfo]$webCsprojInfo)
{
    [string]$angularHomeComponentTsFileName = "$($webCsprojInfo.angularComponentDir)\home.component.ts"
    [string]$newUrl = "/home"
    Write-Output "### Add home page component to $angularHomeComponentTsFileName"
    New-NgHomeComponentTsToString | Out-FileUtf8NoBom $angularHomeComponentTsFileName

    [string]$angularHomeComponentHtmlFileName = "$($webCsprojInfo.angularComponentDir)\home.component.html"
    Write-Output "### Add home page HTML to $angularHomeComponentHtmlFileName"
    New-NgHomeComponentHtmlToString $webCsprojInfo | Out-FileUtf8NoBom $angularHomeComponentHtmlFileName

    [string]$angularHomeComponentCssFileName = "$($webCsprojInfo.angularComponentDir)\home.component.css"
    Write-Output "### Add component HomeComponent Css to $angularHomeComponentCssFileName"
    New-NgHomeComponentCssToString | Out-FileUtf8NoBom $angularHomeComponentCssFileName

    # Add import to app.module
    Write-Output "### Add component HomeComponent to app.module.ts"
    Edit-NgModuleAddComponent $webCsprojInfo "HomeComponent" "./component/home.component"

    # Add route
    Write-Output "### Add route for HomeComponent to app-routing.module.ts"
    Edit-NgModuleAddRoute $webCsprojInfo "HomeComponent" "./component/home.component" ""
}