#.ts variable to html

5 messages · Page 1 of 1 (latest)

shrewd sentinel
#

I have 2 variables (next, prev) i want to forward to my html how can i do this?

displayArticle(param: string) {
    this.lawElement = this.law.getElementForKey(param) as LawTextElement;

    //get article name
    var onlyArticle = this.lawElement?.header?.substring(0, findEndOfNumber(this.lawElement.header));

    //set meta data
    if(onlyArticle != null) {
      this.meta.update(
        '' + onlyArticle + ' DSGVO',
        'dsgvo ' + onlyArticle.toLowerCase(),
        'DSGVO ' + this.lawElement.header,
      )
    }
    console.log(returnNumbers(onlyArticle));

    var next: any;
    var nextCalc: any;
    var prev: string;
    var prevCalc: any;
    if(onlyArticle != null ){
      nextCalc = returnNumbers(onlyArticle)+1;
      prevCalc = returnNumbers(onlyArticle)-1;
      next = "text"+nextCalc;
      prev = "text"+prevCalc;
      console.log("next: " + next);
      console.log("prev: " + prev);
    }
    else{
      console.log("no article found")
    }
  }
river mural
#

Please stop using var. Stop using any. Make the Tour of Heroes tutorial. What is accessible to the view are the public properties of its component.

warped cypress
#

g!toh @shrewd sentinel

cosmic lanceBOT
#

@shrewd sentinel The place we recommend starting your Angular journey is with the Tour of Heroes tutorial, located here https://angular.io/tutorial.

shrewd sentinel
#

I was just dumb and used routerLink wrong ty anyway :)