0
특성을 통해 전달되는 위치에서 범위에 액세스해야하는 지시문이 있습니다.지시문의 범위 경로에서 모델 액세스
HTML :
<div my-directive scope-location="settings.main.url">
...
</div>
지침 :
link: function(scope, elm, attrs) {
// How can I do
// scope['settings']['main']['url'] = angular.element(elm).text();
// where "['settings']['main']['url']" comes part from attr "scope-location"
// with value "settings.main.url"?
scope[attrs.scopeLocation] = angular.element(elm).text();
}
바이올린 : http://jsfiddle.net/GEhSG/3/
많은 감사합니다. 두 번째 정확하게 필요한 것입니다. – Delremm