Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/33.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/68.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
仅使用html解析angular 4中从父组件到子组件的数据_Angular - Fatal编程技术网

仅使用html解析angular 4中从父组件到子组件的数据

仅使用html解析angular 4中从父组件到子组件的数据,angular,Angular,我在angular 4中编写了一个组件,该组件只有一个html播放器,其思想是,对于需要视频的每个组件,只使用html解析来自父级的src,如下所示: 父组件 <div class="wrapper"> <app-my-video src="./path/myvideo"></app-my-video> </div> <video width="320" height="240" controls> <source

我在angular 4中编写了一个组件,该组件只有一个html播放器,其思想是,对于需要视频的每个组件,只使用html解析来自父级的src,如下所示:

父组件

<div class="wrapper">
    <app-my-video src="./path/myvideo"></app-my-video>
</div>
<video width="320" height="240" controls>
  <source "put the src from the parent here" type="video/ogg">
</video>

子组件

<div class="wrapper">
    <app-my-video src="./path/myvideo"></app-my-video>
</div>
<video width="320" height="240" controls>
  <source "put the src from the parent here" type="video/ogg">
</video>

希望是有道理的。如果这种方法不可行,你能建议一种替代方法吗? 谢谢大家。

@Input()
指令

类MyVideoComponent{
@Input()src:string;
}