我希望将所有请求与一个不以'api'开头的PathVariable匹配.我在RequestMapping之后测试.spring可以匹配请求,但无法获得PathVariable的值.我怎么解决这个问题?
@RequestMapping(value = "/{name:(?!api).+}", method = RequestMethod.GET)
public void getNotApi(@PathVariable String name, HttpServletResponse response) {
...
}
Run Code Online (Sandbox Code Playgroud)
我收到一些请求的消息如下localhost:8080/resource.
Error 500 Missing URI template variable 'name' for method parameter of type String
如何让 iframe 显示 React 组件中的本地 html 文件。我的问题是,当我指向我的语言环境 html 文件时,反应路由器会接收请求并重定向到主页。所以 iframe 显示的是主页而不是静态 html 页面。
我的 $scope 中有一个对象,其中包含一些属性,例如以下属性:
$scope.content = {
name : 'myname',
description : 'mydescription',
keyword : 'some keyword'
}
Run Code Online (Sandbox Code Playgroud)
现在我想听听每个属性的每一个变化。我在其自己的对象上设置了监视,但无法更改其属性(其属性是通过绑定到某些输入字段从 UI 更改的)。
$scope.$watch('content', function(){
// do some work
}
Run Code Online (Sandbox Code Playgroud)
当我如下设置监视某些属性时,我可以获取该属性的更改。
$scope.$watch('content.name', function(){
// do some work
}
Run Code Online (Sandbox Code Playgroud)
有没有办法在不设置所有属性的监视的情况下监听对象属性的变化?