Question: I'm in the process of writing an application which will allow the user to generate a variety of reports. There is a button which will bring up another window allowing the user to choose a specific date for the report. Now, my boss wants the head label to read what you're selected a date for, i.e. "Payroll Report Date Selection" or "Employee Report Date Selection". In my situation, this window looks exactly the same, aside from this label. My question is, is it feasible to reuse this window and just change the label based upon a passed parameter, or should I have a window for each? The code is going to work the same on all of them. Are there benefits to reusing the same window versus one window for each one?

Answer: 
I realize this question has been answered, however I have a suggestion:

```
$scope.$watch('fieldcontainer', function (new_fieldcontainer, old_fieldcontainer) {
    if (typeof old_fieldcontainer === 'undefined') return;

    // Other code for handling changed object here.
});

```

Using flags works but has a bit of a [code smell](http://en.wikipedia.org/wiki/Code_smell) to it don't you think?
Just valid the state of the new val:

```
$scope.$watch('fieldcontainer',function(newVal) {
      if(angular.isDefined(newVal)){
          //Do something
      }
});

```