html/jquery로 작성된 이전 응용 프로그램을 angularjs로 이식하려고합니다. 시나리오가 목록입니다 및 갈매기의 클릭에 그냥 아래 아이콘 설정 (아래 이미지) 갈Angular JS 지시문
방법 지시어입니다 보여줍니다, 그리고 내가 맞게 하나를 수정하려고했다 대본. 나에게 불분명 한 점은 한 번에 한 세트의 아이콘 만 어떻게 제한 할 것인가입니다.
당신이 $ (". icon-set")을 했으므로 모든 아이콘 세트가 아이콘 세트로 클래스를 가지고 있었기 때문에 hide() 아이콘을 숨기고 필요할 때 클릭 할 때 갈매기 모양의 아이콘이 표시됩니다.
각형의 경우 여러 문제가 있습니다. 나는이 목록
<ul class="list" ng-repeat="file in files| filter: { folder:'false' }" >
<li class="list-main" >
<ext-img file-name="{{file['file-name']}}"></ext-img>
<div class="list-info">
<div class="list-header">{{file['file-name']}}</div>
<div class="list-info-bottom dimfont"><small>{{ file['modified-timestamp'] | date:'medium' }}</small></div>
</div>
<action-button class="chevron" id="{{file['file-path']}}/{{file['file-name']}}"></action-button>
</li>
</ul>
에게 지침을 만들었습니다,) (element.bind을 위해 (아래 코드) 작동하지 않습니다 어떻게 난 단지리스트 요소 중 하나 보여 않습니다.
myapp.directive('action-button',function(){
return {
restrict: 'E',
template: {
},
link: function(scope,element,attrs){
// This populates the options mene, Bind onclick event
element.bind("click",function(){
// Append the options to it.
var str = '';
str += "<div class=\"options-box\">" ;
str += "<ul class=\"options-inner\">" ;
str += "<li class=\"options-item\">" ;
str += "<a href=\"#\" ng-click = \"\">" ;
str += "<img class=\"options-img\" src=\"images/share_file.png\">" ;
str += "<div>Share</div>" ;
str += "</a>" ;
str += "</li>" ;
str += "</ul></div>";
element.replaceWith(str);
}
)
}
}
})
편집 : 내가 혼란스러워하는 부분은 단 하나의 아이콘 집합 만 표시하는 방법입니다. 편집 : 오타가 수정되었습니다
나는 마침내 효과를 얻었습니다. 당신은 내가 얼마나 감사하고, 나는 3 일 이상 그것에 붙어 있었는지 전혀 모른다. 고마워. 나는 $ rootScope. $ broadcast ("hideAll")와 $ scope. $ on ("hideAll", function() {})의 첫 번째 접근법을 사용했다. 여기 내 마지막 코드입니다. http://play.golang.org/p/efMi8Mr05r 다시 한번 감사드립니다. :) – pers3us