1
여기서 간단한 예Ember에서 핸들 바에 의해 해석되는 동안 문자열을 출력하려면 어떻게해야합니까?
MyApp.ApplicationController = Ember.Controller.extend({
content: "some @user",
parsedContent: function() {
return this.get("content").replace("@user", "<a {{action gotoUser 'user'}}>user</a>");
}.property("content")
});
야하는 대신 핸들 바 템플릿과 같은 내용을 해석하는 것이다 출력
some @user
some <a {{action gotoUser 'user'}}>user</a>
. 나는이 메뉴얼을 컴파일 할 필요가 있다고 생각하지만 올바른 컨텍스트를 전달하는 방법을 모르겠습니다.
작동하는 것처럼 보이지만 데이터 바인딩이되지 않습니다. JSFiddle에서 MyApp.get ("router.applicationController"). set ("content", "whatever")'을 실행하면 템플릿을 다시 렌더링하지 않습니다. –
다시 한번 말하지만, 성능 향상을 위해 핸들 바를 '{{#with content}} {{MyApp.LinkedUsersView contentBinding = "this"}} {{/ with}}' –
으로 변경하십시오. 내용이 변경 될 때 뷰를 다시 렌더링하는 옵저버를 만듭니다. http://jsfiddle.net/bradleypriest/6p6XJ/253/ –