Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I'm trying to allow logged in users to save links. I want the links to display in an array when the user is logged in. Here is my code.

JS

app.controller('CommentCtrl', function($scope, $firebase, FIREBASE_URL, Auth) {
    var saveRef = new Firebase(FIREBASE_URL);
    var savesync = $firebase(saveRef);
    $scope.saveLater = savesync.$asArray();
    $scope.saveIt = function(item, link, saver) {
        $scope.saveLater.$add({item: $scope.item.title, link: $scope.item.link, saver:   Auth.user.email});
    };
)};

HTML

<button ng-disabled="!signedIn()" ng-click="saveIt(save)"</button>

<div ng-repeat="save in saveLater" ng-hide="!signedIn()">
    <a href="{{save.link}}" ng-show="Auth.user.email === save.saver">{{save.item}}
    </a>
</div>

I've tried a number of different ways. None have provided me with any luck. I've also considered using filters, but am certain there is a better way to go about this.

share|improve this question
    
<button ng-disabled="!signedIn()" ng-click="saveIt(save)"></button> must be inside ngRepeat div. –  dfsq Oct 29 at 7:50
    
hmm. They are on separate views. ng-repeat is part of a partial. –  Knish_delish Oct 29 at 7:53

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.