0

I need to change the value in my HTML ->

For example ->

compontent .ts

public varBoolean: boolean;

HTML->

  1º <a>
     <a  href="http://localhost:8090/download/{{varBoolean}}">
      </a>

    2º<a>

     <a href="http://localhost:8090/download/{{varBoolean}}">
     </a>

in 1º "var" = true; but in my 2º = false. I need that my var have the same name because my server get for name->

  @RequestMapping(method = RequestMethod.GET, path = "/download/{varBoolean}

I have tried with:

1º a http://localhost:8090/download/{{varBoolean=true}}
2º a http://localhost:8090/download/{{varBoolean=false}}

But I get an error :/

2
  • what is the "error"? Commented Sep 20, 2018 at 7:55
  • {{varBoolean=true}} will not work because you can't use assignment operator in an interpolation Commented Sep 20, 2018 at 7:56

1 Answer 1

2
@RequestMapping(method = RequestMethod.GET, path = "/download/{varBoolean}

doesn't mean that you need to use same "varBoolean" in client side

Wrong

{{varBoolean=true}} will not work because you can't use assignment operator in an interpolation

1º a http://localhost:8090/download/{{varBoolean=true}}
2º a http://localhost:8090/download/{{varBoolean=false}}

what you need instead is

1º a http://localhost:8090/download/true
2º a http://localhost:8090/download/false

So you can use any variable name or any number of variable to keep true of false in your cline side and append path variable to url

If boolean value is dynamic then you can do

component

1DegreeBoolean = true;
2DegreeBoolean = false;

html

1º <a>
     <a  href="http://localhost:8090/download/{{1DegreeBoolean}}">
      </a>

    2º<a>

     <a href="http://localhost:8090/download/{{2DegreeBoolean}}">
     </a>
Sign up to request clarification or add additional context in comments.

2 Comments

thanks for you response, But I used this -> /true or /false , the problem es that I have a controller in my server, then , My controller "hate" this method -> /true or /false ... with 1 or 2 params, all is correct, I can use /true or /false, but with 3 or 4, I cant use this method. so , I am trying with change the value in html.
@EduBw your controller is having path = "/download/{varBoolean} which means which can take 1 path variable which is what I am doing and varBoolean is a path variable not a request param. Please have a look at Spring Boot Rest documentation, you will get more info

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.