Friday, November 15, 2019

jquery - How can I use $ in ngOnInit or constructor?

I have a problem with using $ in constructor.
ngOnInit()
translate.instant etc.
here is my code:




declare var $: any;
{
var SelectedDevice = $("#select2-example-basic".val();
}


and here is what i got when I tried to run this code.



I do not know why I couldnt use $ in constructur ngOnInit Translate.instant etc. but it works in other functions , for instance: in




onClick(){
var infoDataTable = $('#basic-table').DataTable().page.info();
}


.. there is no error or fail...



and here is my html cod:




    




























{{'Plate'|translate}} {{'Driver Name'|translate}} {{'Start Time'|translate}} {{'Starting Address'|translate}} {{'End Time'|translate}} {{'Ending Address'|translate}} {{'Work Duration'|translate}} {{'Distance'|translate}}
{{item.Name}} {{item.DriverName}} {{item.StartTime | date:'dd.MM.yy hh:mm'}} {{item.StartAddress}} {{item.EndTime | date:'dd.MM.yy hh:mm'}} {{item.EndAddress}} {{item.RunningTime}} {{item.Km | distance}}






I was wondering if it would be possible to help me about how can ı Use $ for this issues?
thanks in advance...



for doing npm install @types/jquery I got this error:error is here

No comments:

Post a Comment

hard drive - Leaving bad sectors in unformatted partition?

Laptop was acting really weird, and copy and seek times were really slow, so I decided to scan the hard drive surface. I have a couple hundr...