我目前使用的是AngularJs,因为我过去曾经使用KnockoutJs,所以我想使用类似KnockoutJs的属性with
属性,但似乎无法找到我正在寻找。我AngularJs $范围目前看起来是这样的什么是AngularJs中KnockoutJs的WITH的等效html属性
$scope.data = {
selectedCountry: ...,
...
};
现在SELECTEDCOUNTRY是一个JS对象,在HTML我希望能够做这样的事
<div with="data.selectedCountry">
<div ng-bind="name"/>
<div ng-bind="prop1"/>
<div ng-bind="prop2"/>
<div>
,而不必做什么我目前在做,这是
<div>
<div ng-bind="data.selectedCountry.name"/>
<div ng-bind="data.selectedCountry.prop2"/>
<div ng-bind="data.selectedCountry.prop3"/>
<div>
有没有办法在AngularJs做到这一点?任何帮助将非常感激。谢谢。
真的很简短的答案是,没有相当于'与'。唯一接近的就是'ngController'。 – 2014-10-08 21:47:47