我已经wheels.component嵌套了car.component.
wheels.component:
export class WheelsComponent {
@Output() onLoaded : EventEmitter<string>() = new EventEmitter<string>();
private downloadAllFiles(url: string) {
this.onLoaded.emit('Hello, World 1!');
//some operations to wait
this.onLoaded.emit('Hello, World 2!');
};
}
Run Code Online (Sandbox Code Playgroud)
组件car.component不是在html页面写的,而是通过car-routing.module.ts中的路由调用:
@NgModule({
imports: [
RouterModule.forChild([
{
path: 'sfactmessage/:id',
component: CarComponent,
resolve: {
card: cardResolver
}
}
])
],
exports: [RouterModule]
})
export class CarRoutingModule {}
Run Code Online (Sandbox Code Playgroud)
我想要的是处理来自发出的事件wheels.component,不是car.component,而是在app.component.
是否有可能处理事件app.component?
plunker示例不起作用(对不起,这是我的第一个plunkr示例),但是给出了我的应用程序如何排列的视图.
请帮助我,我正在尝试创建文件上传dropzone.js,但我很难找到删除上传文件的方法。这是我的代码:
索引.php
<div class="container">
<div class="file_upload">
<form action="file_upload.php" class="dropzone">
<div class="dz-message needsclick">
<strong>Drop files here or click to upload.</strong><br />
</div>
</form>
</div>
Run Code Online (Sandbox Code Playgroud)
文件上传.php
include_once("db_connect.php");
if(!empty($_FILES)){
$upload_dir = "uploads/";
$fileName = $_FILES['file']['name'];
$uploaded_file = $upload_dir.$fileName;
if(move_uploaded_file($_FILES['file']['tmp_name'],$uploaded_file)){
//insert file information into db table
$mysql_insert = "INSERT INTO uploads (file_name, upload_time)VALUES('".$fileName."','".date("Y-m-d H:i:s")."')";
mysqli_query($conn, $mysql_insert) or die("database error:". mysqli_error($conn));
}
}
Run Code Online (Sandbox Code Playgroud)
如何放置删除按钮并删除上传的文件?