Cheers Lucas...

Kind reagrds

On Thursday, July 14, 2016 at 2:33:29 PM UTC+2, Lucas Lacroix wrote:
>
> Right... Because you're not scoping correctly. Within a function, even a 
> IIFE, the 'this' pointer is different from the enclosing scope. Example:
>
> class TestClass {
>     someFunc() {
>         // 'this' references an instance of TestClass, so this will work:
>         this.otherFunc();
>
>         (function() {
>               // 'this' references 'window' and this will not work
>               this.otherFunc();
>         })();
>
>         ((function() {
>               // 'this' references the same instance of TestClass as the 
> enclosing scope
>               // due to the bind call, so this will work:
>               this.otherFunc();
>         }).bind(this))();
>
>         (() => {
>              // 'this' references the same instance of TestClass as the 
> enclosing scope
>              // due to the 'fat-arrow' syntax, so this will work:
>              this.otherFunc();
>         })();
>     }
>
>     otherFunc() {
>         console.log('It works!');
>     }
> }
>
> I suggest you use the fat-arrow syntax:
> this.delay(() => {this.createNewDataSource(true);}, 1000);
>
>
>
>
> On Thu, Jul 14, 2016 at 8:07 AM, Simon Azzopardi <
> [email protected] <javascript:>> wrote:
>
>> I am trying like this:
>>
>> delay = (function(){
>>         var timer = 0;
>>         return function(callback:any, ms:any){
>>             clearTimeout (timer);
>>             timer = setTimeout(callback, ms);
>>         };
>>     })();
>>
>>
>>     clientSearchFilter($event:any){
>>         this._searchKeywords = $event.target.value;
>>     
>>          this.delay(function(){
>>             this.createNewDataSource(true);
>>         }, 1000 );
>>     }
>>
>> but is telling me this.createNewDataSource is not a function
>>
>> On Thursday, July 14, 2016 at 1:56:05 PM UTC+2, Simon Azzopardi wrote:
>>>
>>> Hi Lucas 
>>>
>>> I have tried it out but I cannot call a function which I have in my 
>>> component... telling me that my function is not a function :/
>>>
>>> Any help?
>>>
>>> On Thursday, July 14, 2016 at 1:12:17 PM UTC+2, Lucas Lacroix wrote:
>>>>
>>>> Then use the standard Javascript setTimeout function.
>>>>
>>>> On Thu, Jul 14, 2016 at 6:27 AM, Simon Azzopardi <
>>>> [email protected]> wrote:
>>>>
>>>>> Hi Lucas,
>>>>>
>>>>> I need to store the string in another value to be passed to ag-grid.
>>>>>
>>>>> All I want just to timeout the keyup...
>>>>>
>>>>> On Thursday, July 14, 2016 at 12:11:49 PM UTC+2, Lucas Lacroix wrote:
>>>>>>
>>>>>> Take a look at ng2-bootstrap. It already has a typeahead component 
>>>>>> which should do what you want:
>>>>>> http://valor-software.com/ng2-bootstrap/#/typeahead
>>>>>>
>>>>>> On Thu, Jul 14, 2016 at 6:05 AM, Simon Azzopardi <
>>>>>> [email protected]> wrote:
>>>>>>
>>>>>>> Hi guys,
>>>>>>>
>>>>>>> Does anyone can give some help on how to achive this:
>>>>>>>
>>>>>>> I need to on keyup on an input, an event will be trigerred to get 
>>>>>>> the input value and search for through server side.
>>>>>>>
>>>>>>> But in order to sent to many, I need some delay after keyup, just 
>>>>>>> like after finishes entering a word
>>>>>>>
>>>>>>> Can anyone give me some insight regarding this please?
>>>>>>>
>>>>>>> Kind Regards
>>>>>>>
>>>>>>> -- 
>>>>>>> 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 https://groups.google.com/group/angular.
>>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> -- 
>>>>>> Lucas Lacroix
>>>>>> Computer Scientist
>>>>>> System Technology Division, MEDITECH <http://ehr.meditech.com>
>>>>>> 781-774-2293
>>>>>>
>>>>> -- 
>>>>> 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 https://groups.google.com/group/angular.
>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>
>>>>
>>>>
>>>>
>>>> -- 
>>>> Lucas Lacroix
>>>> Computer Scientist
>>>> System Technology Division, MEDITECH <http://ehr.meditech.com>
>>>> 781-774-2293
>>>>
>>> -- 
>> 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] <javascript:>.
>> To post to this group, send email to [email protected] 
>> <javascript:>.
>> Visit this group at https://groups.google.com/group/angular.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
> Lucas Lacroix
> Computer Scientist
> System Technology Division, MEDITECH <http://ehr.meditech.com>
> 781-774-2293
>

-- 
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 https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to