I want to return multiple values, such as 'firstname' and 'secondname' separately. How can I do this?
I tried to return them as a string, but it's not working:
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
pageheader : string = 'text';
imagepath : string = 'https://3wga6448744j404mpt11pbx4-wpengine.netdna-ssl.com/wp-content/uploads/2018/11/Treehouse-Logo-Green-Large.png';
firstname : string ='Tom';
secondname : string =' Hopkins';
getfullName(): string
{
return this.firstname;
return this.secondname
}
returnstatements in a single block, instead you can return object having both values and use it whereever you want!