我有這樣一個觀點:Angularjs渲染視圖與範圍值
<div ng-show="">
<div style='background-color: #13a4d6; border-color: #0F82A8'>
{{headerdescription}}
<div style='float: right'>{{price}} $</div>
</div>
<div style=' width: 60%; float: left;'>
<div style='padding: 10px;margin-top: 10px;'>{{description}}</div>
<div style='padding: 10px;margin-top: 10px;'>{{softvalues}}</div>
</div>
<div style='float: right; margin-top: 10px;'>
<img src='data:image/png;base64,{{image}}'>
</div>
,我想我在我的角度代碼來獲得這一觀點與設定的範圍值。
我嘗試這樣做:
$scope.headerdescription = "YEEES";
$http.get('App_JsQuote/directives/door.html').success(function (html) {
console.log(html);
});
但問題是,範圍值未設置併爲此視圖像以前變得越大。我如何設置範圍值,然後獲取應該在那裏的所有數據的視圖?
http://stackoverflow.com/questions/18690804/insert-and-parse-html-into-view-using-angularjs – KreepN
您是否使用'ngRoute'或'用戶界面 - router'? –
你想要注入html嗎?看起來好像有人寫了一個指令(從URL判斷),在這種情況下,你不會使用'$ http.get',而是使用指令本身。 你的ng-show表達式將對falsy進行評估('ng-show =「」')。 [這是ng-show的plnkr](http://plnkr.co/edit/YgjARFdJOk84PTvOm50C?p=preview) –