小编Ser*_*gey的帖子

父组件的angular 2访问子组件属性

需要访问属性children元素.家长:

<div>
   <shipment-detail #myCarousel ></shipment-detail>
</div>
Run Code Online (Sandbox Code Playgroud)
@Component({
  selector: "testProject",
  templateUrl: "app/partials/Main.html",
  directives: [ShipmentDetail] })
class AppComponent { 
  getChildrenProperty() {
  // I want to get access to "shipment" 
  }
}
Run Code Online (Sandbox Code Playgroud)

儿童:

@Component({
  selector: "shipment-detail",
}) 
export class ShipmentDetail  {
  shipment: Shipment;
}
Run Code Online (Sandbox Code Playgroud)

typescript angular

23
推荐指数
2
解决办法
3万
查看次数

标签 统计

angular ×1

typescript ×1