Angularjs, Firebase, AngularFire에서 푸시로 생성 된 고유 ID의 이름을 참조합니다.

StackOverflow https://stackoverflow.com//questions/22030331

  •  21-12-2019
  •  | 
  •  

문제

템플리트에서 어떻게 객체를 Firebase로 밀어 넣을 때 제공되는 고유 ID입니다.

나는 이것을 가지고있다 :

 -JGfp5eaDEk2_oB_Wnkc
     category_id: xxxx
     content: xxx
     created: xxx
     title: xxx
 -JGfqwXgeHSksqcmeGEv
     category_id: xxx
     content: xxx
     created: xxx
    title: xxx
.

나는 그것을 사용하여 그것을 얻었다 :

var ref = firebaseRef('/types');
$scope.types = $firebase(ref);
.

이제는 다음과 같은 내 템플릿에 링크를 만들고 싶습니다.

<a href="update/JGfqwXgeHSksqcmeGEv">Update</a>
.

도움이 되었습니까?

해결책

<ul><li ng-repeat="(key, value) in types">
<a href="update/{{key}}">Update</a>
</li></ul>
.

http://docs.angularjs.org/api/ng/directive/ngrepeat <./ a>

다른 팁

plnkr / strong> 가장 간단한 CRUD 응용 프로그램 인 Angularjs + Firebase + Bootstrap을 사용합니다.

또한 포크 + 별이 git

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top