When $scope.instrumentNames is setting inside the controller like on the code provided it works
When $scope.instrumentNames is setting in the HTTP success function it doesn't work
The data returned by the http function IS an Array.
Console.log(data)//["Guitar", "Bass", "Violin"]
Console.log($scope.instrumentNames) //["Guitar", "Bass", "Violin"]
Controller
app.controller("PrivateProfileController",
    ["$scope", "$http", "$routeParams",  function( $scope, $http, $routeParams ) {
        $scope.instrumentNames = ["Guitar", "Bass", "Violin"];//WORKING !
        function loadInstrumentNames(){
            $http({
                url: '/Instrument/getInstrumentsName',
                method: "GET"
            }).success(function(data){
                //data = ["Guitar", "Bass", "Violin"]
                $scope.instrumentNames = data;//NOT WORKING 
            });
        }
        loadInstrumentNames()
    }]
);
Directive
app.directive('autoComplete', [function($timeout) {
    return    {
        restrict: "A",
        link : function(scope, element, attrs) {
            element.autocomplete({
                source: scope[attrs.uiItems],
                select: function() {
                    $timeout(function() {
                      element.trigger('input');
                    }, 200);
                }
            });
        }
    };
}]);
Template
<input auto-complete ui-items="instrumentNames">
It's like the directive is called before the http success is finished. Im stuck with this problem and any help or suggestion would be very appreciated!
Thanks
 
    