title: Getting an Array with Angular 2 from mongoose mongoDB database
body: <p>I am trying to retrieve my Members collection in my angular 2 front end.</p>
  
  <p>in my routes I have:</p>
  
  <pre><code>router.post('/memberprofile', function (req, res) {
      Member.find({}, function (err, members){
          if (err){
              console.log(err);
          }else{
             res.json(members);
             console.log('retrieved members', members.length);
             console.log(members);
          }
     });
  });
  </code></pre>
  
  <p>I am attempting to GET it by using this code:</p>
  
  <pre><code>export class MemberprofileComponent implements OnInit {
        member:Object;
        members:Array&lt;Object&gt;;
        result:Array&lt;Object&gt;;
        constructor(
        private authService:AuthService,
        private router:Router,
        private http:Http
        ) {
   this.http.get('http://localhost:3000/users/memberprofile')
                .subscribe(result =&gt; this.result = result.json());
                console.log(this.result);
                 }
  </code></pre>
  
  <p>I am then given the following error in the console:</p>
  
  <p>SyntaxError: Unexpected token &lt; in JSON at position 0</p>
  
  <p><a href="https://i.stack.imgur.com/92EnI.png" rel="nofollow noreferrer">Screenshot of Network Tab</a></p>
  
  <p><a href="https://i.stack.imgur.com/YUgOB.png" rel="nofollow noreferrer">Screenshot of Response</a></p>
  
  <p>My question is, how am I able to push the array to the front end, I hope to eventually place the result into a table but at the moment if anyone can work out why I cant console log this array that would be great.</p>