我收到此错误:this.props.postBooks不是函数。
我有一个动作-postBooks-我正尝试通过道具发送。
这是我的组件:
"use strict"
import React from 'react'
import {Well,Panel,FormControl,FormGroup,ControlLabel,Button} from 'react-bootstrap'
import {connect} from 'react-redux'
import {bindActionCreators} from 'redux'
import {postBooks} from '../../actions/booksActions'
import {findDOMNode} from 'react-dom'
export class BooksForm extends React.Component{
handleSubmit(){
const book = [{
title: findDOMNode(this.refs.title).value,
description: findDOMNode(this.refs.description).value,
price: findDOMNode(this.refs.price).value
}]
this.props.postBooks(book)
}
render(){
return(
<Well>
<Panel>
<FormGroup controlId='title'>
<ControlLabel> Title </ControlLabel>
<FormControl
type='text'
placeholder='Enter Title'
ref='title' />
</FormGroup>
<FormGroup controlId='description'>
<ControlLabel> Enter Description </ControlLabel>
<FormControl
type='text'
placeholder='Enter Description'
ref='description' />
</FormGroup>
<FormGroup controlId='price'>
<ControlLabel> …Run Code Online (Sandbox Code Playgroud) VS Code 将所有 html 文件默认为 Django 模板并以错误的方式对其进行注释(如果我按 ctrl + /)
即它通过添加 {% comment %} & {% endcomment %} 而不是正确的 html 注释来注释普通的 html 文件 <!-- -->
我正在使用Spring安全性库来保护我的应用程序中的REST api,现在尝试尝试允许(临时)访问所有URL,但是通过以下配置,我发现仅允许GET请求,而不允许POST请求(在这里我得到403)禁止响应),我知道下面的第一个antmatcher应该同时允许GET和POST,但实际上2个antMatchers不允许POST
有人可以告诉我我在这里缺少什么吗?
protected void configure(HttpSecurity http) throws Exception {
http
.authorizeRequests()
// first I have tried only this antMatcher
.antMatchers("/**").permitAll()
// But then it didn't allow POST even when only using the line below
.antMatchers(HttpMethod.POST, "/**").permitAll()
}
Run Code Online (Sandbox Code Playgroud) 我有一个创建pdf报告并下载它的spring boot API,如果我直接在浏览器中调用API,则直接创建和下载pdf,但是当我从Angular 6调用GET API时,我收到以下错误:
Spring启动(java)代码:
@RequestMapping(value = "/app_report/en", method = RequestMethod.GET)
@ResponseBody
public void getEnRpt(HttpServletResponse response, @RequestParam("appNum") String appNum) throws JRException, IOException, SQLException {
JasperReport jasperReport = JasperCompileManager.compileReport("./src/main/resources/jasperReports/App_created_en.jrxml");
Connection connection = dataSource.getConnection();
Map<String, Object> params = new HashMap<>();
params.put("P_APP_NO", appNum);
JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, params, connection);
response.setContentType("application/x-pdf");
response.setHeader("Content-disposition", "inline; filename=App_report_en.pdf");
final OutputStream outStream = response.getOutputStream();
JasperExportManager.exportReportToPdfStream(jasperPrint, outStream);
}
Run Code Online (Sandbox Code Playgroud)
调用API的Angular代码:(我试过多种方式,这里显示了两个):
this.http.get(this.api_url + reportUrl, {
responseType: 'blob'
}, ).subscribe((response: File) => {
console.log('report is downloaded');
});
this.http.get(this.api_url + reportUrl).subscribe(
(response) => …Run Code Online (Sandbox Code Playgroud) 我试图使用vs代码git plugin从gitlab克隆git repo,但我一直收到此错误:
ssh_askpass: exec(/usr/bin/ssh-askpass): No such file or directory Host key verification failed
Run Code Online (Sandbox Code Playgroud)
在此之前,我确保将ssh密钥添加到Gitlab中,并且已授权该密钥可以访问存储库,如何解决此问题?
我正在尝试将一个组件(例如称为custom-input)封装为基于 Angular 材质组件的 formControl 元素,以包含以下内容:
<mat-form-field >
<input
matInput
[formControl]="inputField"
formControlName="{{ name }}"
name="{{ name }}"
maxlength="{{ maxlength }}"
placeholder="{{ name | translate }}"
required
/>
<mat-error *ngIf="inputField.errors">{{
this.validationService.getErrorMsg(inputField.errors)
}}</mat-error>
</mat-form-field>
Run Code Online (Sandbox Code Playgroud)
现在这个组件正在使用所需的功能,但不能像普通输入或 matInput一样使用 formControlName 属性绑定到 formGroup(例如下面的例子,它直接绑定到 formGroup 没有问题)
<input
matInput
formControlName="inputField123"
placeholder="{{ 'testInput' | translate }}"
required
/>
Run Code Online (Sandbox Code Playgroud)
问题是如何让上面的组合组件绑定为formGroup中的formControl元素?我应该实现或公开什么来提供此功能?
我应该使用 ControlValueAccessor 还是有更好的方法用于材质输入组件?
javascript typescript angular2-forms angular angular-reactive-forms
我正在尝试学习python并在尝试在网站上解决此测验时,我得到一个奇怪的错误,即第二个参数的断言失败,而if ifif语句是正确的并且应该给出正确的输出(但它给出错误的意外输出)
错误是:
"C:\Program Files\Python36\python.exe" C:/Users/.../PycharmProjects/pythonSnakegame/snakeGame.py
Fizz Buzz
Traceback (most recent call last):
Fizz Buzz
File "C:/Users/..../PycharmProjects/pythonSnakegame/snakeGame.py", line 28, in <module>
assert checkio(6) == "Fizz", "6 is divisible by 3"
AssertionError: 6 is divisible by 3
Process finished with exit code 1
def checkio(number):
# Your code here
# It's main function. Don't remove this function
# It's using for auto-testing and must return a result for check.
if number % 3 == 0 & number % 5 == 0: …Run Code Online (Sandbox Code Playgroud) angular ×2
javascript ×2
typescript ×2
fizzbuzz ×1
git ×1
html ×1
if-statement ×1
java ×1
python ×1
react-redux ×1
reactjs ×1
redux ×1
spring ×1
ssh ×1