title: In firebase, how can I detect what value is existing?
body: <p>What I want to create is just a 'room-maker' app.</p>
  
  <p>This is just an app that if user input a room Number and click the "Join" button, </p>
  
  <p>new room is created and the user go to the room(route).</p>
  
  <p>In Firebase, I want to know how I can detect whether room is already existing or not.</p>
  
  <p>I want to make a code like below. </p>
  
  <p>if room is exist, </p>
  
  <pre><code>console.log("The room is existing.");
  </code></pre>
  
  <p>if not, </p>
  
  <pre><code>console.log("You created new room!");
  </code></pre>
  
  <p>My code(partial) is below</p>
  
  <pre><code>    //Firebase Set
      var ref = new Firebase('https://blinding-inferno-7068.firebaseio.com/');
  
      //Room set
      $scope.roomNum = $stateParams.roomNum;
      var roomsRef = ref.child('rooms');
      var roomNumRef = roomsRef.child($scope.roomNum);
      roomNumRef.set({roomNum:$scope.roomNum});
  </code></pre>
  
  <p>I completed the code that make a new room, but how can I detect a room is already existing or not?</p>