मैं कोणीय उपयोग कर रहा हूँ। मेरे में AppComponent
, मैं उपयोगकर्ता लॉग ऑन नहीं है, तो एक प्रवेश पृष्ठ प्रदर्शित करने के लिए करना चाहते हैं।
मैं एक प्रमाणीकरण सेवा है
export class AuthenticationService {
constructor() {}
logout() {
// logs out user
}
login(user) {
//logs in user
}
checkCredentials() {
//checks if logged in
}
}
app.component.ts
import { NgModule, Component } from '@angular/core';
// import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
@NgModule({
})
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
title = 'app';
}
login.component
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-login',
templateUrl: './login.component.html',
styleUrls: ['./login.component.css']
})
export class LoginComponent implements OnInit {
constructor() { }
ngOnInit() {
}
}
क्या मैं लोड करने के लिए मुख्य पृष्ठ के लिए app.component में कर सकते हैं LoginComponent
, तो उपयोगकर्ता के प्रवेश नहीं कर रहा है या DashboardComponent
यदि उपयोगकर्ता अलग यूआरएल के लिए मार्ग के बिना में लॉग ऑन है?