Cannot read property status of undefined angularjs