オブジェクトとオブジェクトを含むスコープ変数にウォッチを適用するには、コンテンツを編集可能なdivでhtmlレイアウトにしたプロパティが1つあります。 contenteditable divをタイプすると、更新されたレイアウトが返されます。ここでディレクティブのリンクメソッドでスコープのDOMオブジェクトを見る
ディレクティブからバインドさ2つの方法である私のスコープ変数である - >
this.scope = {
section : '='
};
そして、このセクションは次のようにオブジェクトを持っている:
this.sections = [
{
'title' : 'Untitle Section New',
'type' : 'customSection',
'layout': '<div class="content-editable" contenteditable="true" style="width: 100%;height: 100%;-webkit-column-gap: 20px;-webkit-column-count:2;-webkit-column-rule: 1px solid red;background-color: #eeeeee;outline: none; position: relative; "><p>This is test.</p></div>'
}
]
そして、ここで私はディレクティブでこのセクションを繰り返しhtmlです:
<book-section data-ng-repeat="section in book.sections"
section="section"
data-ng-show="digitalBook.activeSection === section.index">
</book-section>
ここで、私は各セクションで腕時計を適用したいと思います。コンテンツ編集可能なdivがupated場合私はdomから更新されたhtmlを取得したい。良いパフォーマンスでこれを実行するにはどうすればよいですか?
https://docs.angularjs.org/api/ng/type/ $ rootScope.Scope#$ watchCollectionを参照してください、あなたは 'contenteditable' divのためのサードパーティのプラグイン/モジュールを使用していますか? –
いいえ簡単ですhtmlプロパティcontenteditable @AhmedWagdi –
現在ブックセクションディレクティブのコードを投稿できますか? –