Hello I'm new to Angular and JS so may be this is a known issue or a dumb bug that i made, so i have this controller in which i have this function :

```
        $scope.companies = [];                      
        $scope.BindCompanies = function()
        {
            $scope.companies = JSON.parse( localStorage.getItem( Const.CacheKeys.Companies ) )
            if($scope.companies.length = 0){
                companyService.getAll()
                .then(
                    function (response) 
                    {
                        localStorage.setItem(Const.CacheKeys.Companies, JSON.stringify( response.data.d.results ))
                        $scope.companies = response.data.d.results;

                        setDataTableData();
                    }
                );                  
            }
            else{
                setDataTableData();
            }
        }

```

the problem is that on execution $scope.companies contains data so it continue to else and there $scope.companies is empty !

thank you.