Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

routerLink is not working in angularjs 2 with MVc View.

$
0
0

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';
}
----------------------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;
    }
}

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.


Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>