我一直使用AngularDart創建webapp。我是Dart的新手,因此也是AngularDart,但是已經完成了https://angulardart.org/tutorial/的教程。如何引用組件範圍外的AngularDart組件屬性
我讀過類似的SO問題/答案(How to access a AngularDart components attribute (NgOneWay) outside of the component, eg. on the page it is in?),但鑑於我的知識有限,我不完全理解如何實施Brian的建議 - 或者確實與我的問題有關!我是否也認爲溫克的建議現在不相關,因爲@Controller
現在已被棄用?
總之,我試圖找出如果下面是實際上可實現的:
- 創建一個頂級
<custom-component/>
完整的屬性; - 範圍內
<ng-view/>
- 因此嵌套組件 - 訪問<custom-component/>
的屬性。更具體地說,綁定/監聽這些屬性的更改並採取相應措施。
例如,給定以下
<body>
<custom-component att1="val1" att2="val2"></custom-component>
<ng-view></ng-view>
</body>
和關於<ng-view/>
使下面的標記
<div>
...
<other-component att1="{{customComponent.att1}}" att2="{{customComponent.att2}}"></other-component>
<another-component att1="{{customComponent.att1}}" att2="{{customComponent.att2}}"></another-component>
...
</div>
是能夠結合到customComponent.<<attributeName>>
和<other-component/>
<another-component/>
假設?
或者,我很可能誤解了AngularDart的使用@Component
/@Decorator
?
@att1
和@att2
屬性是否應該從<custom-component/>
移動到<ng-view/>
?
另外,我應該看看完全建立一個不同的解決方案?在這種情況下,我的最終目標是向用戶提供選擇框(來自另一個組件),其依次確定<other-component/>
和<another-component/>
中的每一個內的呈現內容。
任何和所有的建議歡迎,我不會冒犯,如果你解僱任何/上述所有!
我現在的開發環境如下:
- 飛鏢SDK版本1.9.0-dev.8.0
- 角1.0.0
非常感謝,J
感謝您的建議。我曾閱讀過這些文章,但一定不能理解。我會再看看... – j0237857 2015-03-03 13:55:26
只需添加評論,如果你有具體問題。 – 2015-03-03 14:06:41