# How to reach the conditions of the result

**URL:** <https://forum.ionicframework.com/t/how-to-reach-the-conditions-of-the-result/79312>\
**Category:** ionic-v3\
**Created:** [February 12, 2017, 4:25am UTC](https://forum.ionicframework.com/t/how-to-reach-the-conditions-of-the-result/79312 "2017-02-12T04:25:03Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Otacio](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/otacio/32/106831_2.png) [@Otacio](https://forum.ionicframework.com/u/Otacio)\
**Post date:** [February 12, 2017, 4:25am UTC](https://forum.ionicframework.com/t/how-to-reach-the-conditions-of-the-result/79312/1 "2017-02-12T04:25:03Z")

</div>

```
import { Component } from '@angular/core';
import { NavController, ViewController } from 'ionic-angular';

import { HomeService } from './home.service';

export class User {
  username: string;
  password: string;
}

@Component({
    selector: 'page-home',
    templateUrl: 'home.html',
    providers: [
      HomeService
    ]
})

export class HomePage {

  user: User = {
    username: '',
    password: ''
  }

  
  items:any;

 

    constructor(public navCtrl: NavController, public service: HomeService) { }

    login() {
        this.service.getFunctions(this.user)
                    .subscribe(
                        datas => {
                              if(datas)
                                   console.log(datas)
                                          });
                                      }
                                  }

```

This is my home.ts it returns me in 2 ways:

If the login and password are correct it returns me:

Object {result: true, dados: object}

dados: Object

ID:"1"  
LOGIN:"otacio"  
NAME: “OTACIO”

If they are wrong, it returns me:

Object {result: false, msg: “INCORRECT USER”}

What I need:

When the result is true direct to the page: menu

When the result is false display invalid user message or password.

I know the question may be simple, but it is that I am starting in ionic and angular now.

General information:

Ionic Version: 2.2.1  
Node Version:v7.5.0

---

<div class="post-metadata">

**Author:** ![rapropos](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/rapropos/32/100227_2.png) [@rapropos](https://forum.ionicframework.com/u/rapropos)\
**Post date:** [February 13, 2017, 10:01pm UTC](https://forum.ionicframework.com/t/how-to-reach-the-conditions-of-the-result/79312/2 "2017-02-13T22:01:40Z")

</div>

[Here](https://forum.ionicframework.com/t/solved-ionic2-navcontroller-pop-with-params/58104/19?u=rapropos) is the structure I use for situations like this.
