I am trying to give a link at top using Angularjs2 and MVC core
=================app.component.ts=======================
import { Component } from '@angular/core';@Component({
selector: 'pm-app',
template: `
<div>
<nav class='navbar navbar-default'>
<div class='container-fluid'>
<a class='navbar-brand'>{{pageTitle}}</a>
<ul class='nav navbar-nav'>
<li><a [routerLink]="['/welcome']">Home</a></li>
<li><a [routerLink]="['/companies','CompanySignUp']">Sign
Up</a></li>
</ul>
</div>
</nav>
<div class='container'>
<router-outlet></router-outlet>
</div>
</div> ` })
export class AppComponent {
pageTitle: string = 'Product Management';}
================Company.component.ts==============================================================
import { NgModule } from '@angular/core';import { RouterModule} from
'@angular/router';import { CompanySignUpComponent } from
'./CompanySignUp.component';
@NgModule({
imports: [
SharedModule,
RouterModule.forChild([
{ path: 'companySignUp', component: CompanySignUpComponent },
])
],
declarations: [
CompanySignUpComponent,
],
providers: [
]})export class CompanyModule {}
----------------------CompanySignUp.component.ts--------------------------------------
import { Component, OnInit } from '@angular/core';
import { Company } from './Company';
@Component({
templateUrl: '/Company/SignUp'})export class CompanySignUpComponent
implements OnInit {
pageTitle: string = 'Company ';
imageWidth: number = 50;
imageMargin: number = 2;
showImage: boolean = false;
listFilter: string;
errorMessage: string;
toggleImage(): void {
this.showImage = !this.showImage;
}
ngOnInit(): void {
}
onRatingClicked(message: string): void {
this.pageTitle = 'Company : ' + message;
}}
import { NgModule } from '@angular/core';import { BrowserModule } from
'@angular/platform-browser';import { HttpModule } from '@angular/http';import {
RouterModule } from '@angular/router';
import { AppComponent } from './app.component';import { WelcomeComponent }
from './home/welcome.component';
import { CompanyModule } from './companies/Company.module';
@NgModule({
imports: [
BrowserModule,
HttpModule,
RouterModule.forRoot([
{ path: 'welcome', component: WelcomeComponent },
{ path: '', redirectTo: 'welcome', pathMatch: 'full' },
{ path: '**', redirectTo: 'welcome', pathMatch: 'full' }
]),
ProductModule,
CompanyModule
],
declarations: [
AppComponent,
WelcomeComponent
],
bootstrap: [ AppComponent ]})export class AppModule { }
C# MVC View
public IActionResult SignUp()
{
return View();
}
The CompanySignUp.component.ts is located in companies folder under app
folder.
Guide me . There is no error throwing by framework.
--
You received this message because you are subscribed to the Google Groups
"Angular" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.