0
處理指令以突出顯示<code>
標記,該標記正被指令輸出以呈現<markdown>
標記。指令中的指令
問題是在運行<markdown>
指令後<code>
指令從未被命中。然而,<code>
指令在代碼標籤上運行,這些代碼標籤不是從<markdown>
指令輸出的。
降價指令
angular.module('App').directive "markdown", ->
converter = new Showdown.converter()
scope: true
restrict: 'E'
link: (scope, element, attrs) ->
if attrs.markdown
scope.$watch attrs.markdown, (newVal) ->
html = converter.makeHtml(newVal)
element.html(html)
else
redraw = ->
html = converter.makeHtml(element.text())
element.html(html)
#### expecting the code directive to be trigger after this.
scope.$on "$includeContentLoaded", redraw
redraw()
有什麼想法?