Change "is defined" test expression

angular.isDefined returns true if currentLayer is the empty string. Here wen don't want to change the current layer if currentLayer is the empty string so we should not use angular.isDefined.

We should use angular.isDefined when what we really want to test is that the value is defined or undefined.