Here's a third solution using ```parseInt()```:
```javascript
        $scope.setEnvironment = function(environmentId) {
            environmentId = parseInt(environmentId, 10);
            if ($scope.previousEnvironment !== $scope.system.environment.id) {
                $scope.previousEnvironment = $scope.system.environment.id;
                $scope.system.environment.id = environmentId;
                $scope.editContentView = true;
                $scope.$apply();
            }
        };
```
These IDs are supposed to be numbers, not strings, so I prefer we keep them as numbers.