title: In Firebase when using push() How do I get the unique ID and store in my database
body: <p>I am pushing data in firebase, but i want to store unique id in my database also .
  can somebody tell me,how to push the data with unique id.</p>
  
  <p>i am trying like this</p>
  
  <pre><code>  writeUserData() {
      var key= ref.push().key();
      var newData={
          id: key,
          websiteName: this.webname.value,
          username: this.username.value,
          password : this.password.value,
          websiteLink : this.weblink.value
      }
      firebase.database().ref().push(newData);
    }
  </code></pre>
  
  <p>error is  "ReferenceError: ref is not defined"</p>