I've noticed two instances in my code where using ng-if causes my program to start working. On one, I do an ng-if="isOwnProfile", for an image-upload toolbar.
Using the ng-if causes the event listener to stop working. Code example:
   $scope.myOwnProfile = false;
   if (userLoggedIn === userUID) {
     console.log('my images');
     $scope.myOwnProfile = true;
   } else {
     console.log('not my images');
   }
    $("#image-upload").change(function(e) {
    $scope.myOwnProfile = true;
    var file = e.target.files[0];
    var imageRef = firebase.storage().ref...
and in HTML:
<section ng-if="myOwnProfile">
   <input id="image-upload" type="file" accept="image/*"> <br /><br />
</section>
In this case the event listener will stop working and not respond. Another case is where you add a message to the page (and firebase). Code:
    $scope.addMessage = function(){
    var date = new Date();
    $scope.messages.$add({
        timestamp: (date.getMonth() + 1) + "/" + date.getDate() + "/" + date.getFullYear(),
        from: $scope.visitorRealName.name,
        content: $scope.message
    });
    $scope.message = '';
};
HTML:
    <section ng-if="AreWeFriends === true || myOwnProfile === true">
    <form ng-submit="addMessage()">
        <input ng-model="message"> 
        <button type="submit">Add Message</button>
    </form>
    </section>
In the second case I get an error from Firebase "Key content was undefined. Cannot pass undefined in JSON. Use null instead".
I can't determine why using ng-if causes this to happen? What I do is set the user's profile to true whether they are a) a friend or b) it's the person's own profile (which is why I change $scope).
 
     
    