Hi Sander, 

As I told you I am learning curve and I tried to put the same question in 
different forums but I could not got the answer 

But suddenly something trigger in my mind that why we can't use *ngModal* 
which act as ngBind which I want, so first in my directive I added

    require: 'ngModel',

Then in my $scope.validateSingle function I added 
`ngModel.$setViewValue($scope.value);` where $scope.value I was assigning 
with selected value so my validateSingle function become like this 

                $scope.validateSingle = function(item) {
                    $scope.text = item[$scope.textField] + 
($scope.textField2 !== '' ? " (" + item[$scope.textField2] + ")" : "");
                    $scope.value = item[$scope.valueField];
                    $scope.placeholder = 'placeholderBlack';
                    $scope.hideItems();
                    if (typeof $scope.callback == 'function') {
                        $scope.callback($scope.value);
                    }

                    ngModel.$setViewValue($scope.value);
                }
So bingo every thing working like charm as I was wanted. I edited my 
plunker also you can check on 
http://plnkr.co/edit/GxM78QRwSjTrsX1SCxF7?p=preview

Hope it will help to some new learner 

On Tuesday, January 13, 2015 at 7:27:24 AM UTC+3, Milind Saraswala wrote:
>
> Hi Sander,
>
> Any thought on this, Kindly it will be highly appreciated.
>
> Regards,
>
> On Monday, January 12, 2015 at 11:22:54 AM UTC+3, Milind Saraswala wrote:
>>
>> Hi,
>>
>> Actually I am not looking app wide result but lets say my directive is 
>> working like drop-down once I selected item and if I wanted its value in 
>> some button click  then i could use like *dropdown.value* where dropdown 
>> could be id of the directive.
>>
>> Hope I could clear my point.
>>
>> On Monday, January 12, 2015 at 11:12:01 AM UTC+3, Sander Elias wrote:
>>>
>>> Milind,
>>>
>>> If you need the resulting data from this directive in different parts of 
>>> your application, you should use a service to store the result.
>>> Do I see it right as this pop-up does an app-wide setting? I can adapt 
>>> your sample to that, but if that's not what you need, it's not really 
>>> helpful ;)
>>>
>>> Regards
>>> Sander
>>>
>>>

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to