title: Firebase: remove child element is not working
body: <p>I have already tried different kind of solutions to remove child element by key from Firebase-Database, but without any effect. What I am doing wrong?</p>
  
  <p>My database structure looks like this, where <code>players</code> is under the root of the database
  <a href="https://i.stack.imgur.com/yeLyc.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/yeLyc.png" alt="enter image description here"></a></p>
  
  <p>I have an Angular 2 Single Page Application, where in the <strong>index.html</strong> included FireBase-client initialization:</p>
  
  <pre><code>&lt;script src="https://www.gstatic.com/firebasejs/3.5.3/firebase.js"&gt;&lt;/script&gt;
  &lt;script&gt;
      // Initialize Firebase
      var config = {/*....*/};
      firebase.initializeApp(config);
  &lt;/script&gt;
  </code></pre>
  
  <p>Regardless <a href="https://firebase.google.com/docs/database/web/read-and-write#delete_data" rel="nofollow noreferrer">Firebase documentation</a> both deletions are not working:</p>
  
  <pre><code>removePlayer1(id: any): Promise&lt;Response&gt; {
      return firebase.database().ref("players").child(id).once('value')
             .then((snap: any) =&gt; {
                console.log("Player was removed", id, snap);
                snap.remove();
             }).catch((err: any) =&gt; this.handleError(err));
  }
  
  removePlayer2(id: any): Promise&lt;Response&gt; {
      return firebase.database().ref().child('players')
            .child(id).remove().then((r: any) =&gt; {
                console.log("Player was removed", id);
            }).catch((err: any) =&gt; this.handleError(err));
  }
  </code></pre>
  
  <p><a href="https://stackoverflow.com/a/38684411/3146132">This solution</a> still is not working:</p>
  
  <pre class="lang-js prettyprint-override"><code>removePlayer(id: any): Promise&lt;Response&gt; {
      var updates = {};
      updates[id] = null;
      return firebase.database().ref("players").update(updates)
               .then((r: any) =&gt; {
                 console.log("Player was removed", id, r);
               }).catch((err: any) =&gt; this.handleError(err));
  }
  </code></pre>
  
  <p>At the same time update and insert child values perfectly works:</p>
  
  <pre class="lang-js prettyprint-override"><code>savePlayer(player: IPlayer): Promise&lt;Response&gt; {
      let playerRef: any;
      if (!player._id) {
          playerRef = firebase.database().ref().child('players').push().set(player);
      } else {
          var updates = {};
          updates[player._id] = player;
          playerRef = firebase.database().ref().child('players').update(updates);
      }
  
      return playerRef.catch((err: any) =&gt; this.handleError(err));
  }
  </code></pre>
  
  <p>Thanks!</p>