Question: In the following pipeline, I am trying to check out only develop branch to build the given project. How do I make sure that the pipeline only run develop, master and release branches?
Should I add separate stages for master branch and another for release branch. Instead I am trying to let this pipeline build only when there are changes in develop or master or release branches and ignore building for any other branches.

In Jenkins > Freestyle project > Source code management > Git > User can enter specific branches in Branch specifier. How can I implement similar one using pipeline?

```
pipeline {
agent any
tools {
    maven "${mvnHome}"
    jdk  'jdk8'
}
stages {
stage('Checkout project') {
    steps {
        git branch: 'develop',
            credentialsId: 'someid',
            url: 'https://project.git'
    }
}

    stage('build') {
        steps {
            sh '''
             mvn clean deploy
            '''
            }
        }
    }
}

```

Answer: 
Generally Angular services are meant to handle data retrieval and all business logic, while the components subscribe to Observables for display purposes.

If I understand your situation correctly, you'd be better off doing something like this:

**Service**

```
public person$$ = new BehaviorSubject<unknown>(null);
public person$ = this.person$$.asObservable();

public getPerson(): void {
    // logic for retrieving data
    this.person$$.next(response);
}

```

**Component**

```
public person$ = this.incomeService.person$;

// if you wanted to use console for debugging you could also add
// .pipe(tap(person => console.log(person)))
// which would log to console whenever the person$$ subject is updated in the service

constructor(private incomeService: IncomeService) {}

ngOnInit(): void {
    this.incomeService.getPerson();
}

```

**Template**

```
<ng-container *ngIf="person$ | async as person">
{{ person | json }}
</ng-container>

```

In this case, because the `async` pipe is used in the template, it automatically handles the subscription (and unsubscribing when the component is destroyed). You could also `.subscribe` in the component logic, just make sure to have an `unsubscribe` call in there somewhere to prevent memory leaks.
The problem was in a function that was generating an error and that is executed before calling `next`. Unfortunately I missed it because errors in my Google Chrome console were hidden.

So as a reminder for anyone else having a similar problem; check that your methods are running error free before panicking.