【发布时间】:2019-07-26 01:54:01
【问题描述】:
我使用了 angualr 7,并且我将来自 angular 服务类的值传递为:
executeHelloWorldBeanServiceWithPathVariable(name){
console.log("name coming from here"+name);
return this.httpClient.get<HelloWorldBean>('http://localhost:8080/hello-world/path-variable/${name}');
console.log("hello world bean service executed");
}
在我测试时,该名称正在控制台中打印:
console.log("name coming from here"+name);
在这里打印在控制台没有问题。
在我的春季靴子中,我声明为:
@GetMapping(path="/hello-world/path-variable/{name}")
public HelloWorldBean helloWorldBeanPathVariable(@PathVariable("name") String name) {
System.out.print("name is"+name);
return new HelloWorldBean(String.format("Hello world %s", name));
}
当我尝试使用以下方法进行调试时,我从 angular 传递的名称参数没有被打印出来:
System.out.print("name is"+name);
但它显示在el表达式中
所以在我的 UI 中,我得到了:
【问题讨论】:
标签: javascript java angular spring typescript