Sitelet https://web.archive.org/web/20211024152621/https://gitter.im/angular/angular

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
mile-mijatovic
@mile-mijatovic
@johonunu vidi private
mile-mijatovic
@mile-mijatovic
@johonunu please private
Aakash Giri
@0APOCALYPSE0
Hi all, I am facing one problem with jsPDF in generating pdf from HTML so if I am using html() method for generating pdf then css of that HTML not applying properly in pdf. Is there any way to fix the css related issue? But if I am generating with the help of html2canvas then everything is working fine only problem is a low-quality image I am getting, but if I am increasing the scale of the image then it is taking too much time in generating pdf. So what is the best way to generate pdf from HTML? Thanks
Dominic Watson
@intellix

just realised in my Universal app that Angular doesn't wait for my AWS Lambda invokes before returning the server response... I can't for the life of me get this wrapped in Zone.... how can I?

import AwsLambda from 'aws-sdk/clients/lambda';
import { Agent } from 'https';

return new AwsLambda({
  httpOptions: {
    agent: new Agent({
      keepAlive: true,
      maxSockets: 50,
      rejectUnauthorized: true,
    }),
  },
})
  .invoke({
    FunctionName: 'some-graphqlServer',
    InvocationType: 'RequestResponse',
    Payload: JSON.stringify(payload),
  })
  .promise();

I would have thought https in Node would be wrapped in a Zone... or maybe it's a problem with AwsLambda lib instead?

mile-mijatovic
@mile-mijatovic
Hello
I have lazy loading module , and I am trying to get current url 'id'
but it's empty every time
    this.route.queryParams.subscribe((queryParams: Params) => {
      this.dataModel.PropertyID = queryParams['id'];
      console.log('ID', this.dataModel.PropertyID);
    });
Dominic Watson
@intellix

@mile-mijatovic do you have this in your Router root module?

RouterModule.forRoot([], {
  paramsInheritanceStrategy: 'always',

It'll allow your params to pass through all child components of a Routed component. it could be that you're looking in a child component (I don't know looking at your example)

mile-mijatovic
@mile-mijatovic
@intellix thanks
I did on this way already
    this.dataModel.PropertyID = this.router
      .parseurl(/sitelet?url=https%3A%2F%2Fweb.archive.org%2Fweb%2F20211024152621%2Fhttps%3A%2F%2Fgitter.im%2Fangular%2F%253Cspan%2520class%3D%2522keyword%2522%253Ethis%253C%2Fspan%253E.router.url)
      .root.children.primary.segments[2].toString();
mile-mijatovic
@mile-mijatovic
can you help me with BehaviorSubject?
I want to separate business logic (fetching data) and displaying data
business logic will be in service
platform.service.ts
...
  private propertySubject: BehaviorSubject<any> = new BehaviorSubject(this.dataModel);

  getPropertyData(): Observable<any> {
    return this.propertySubject.asObservable();
  }

  loadPropertyData() {
    let apiURL =
      Globals.baseAPIURL + 'investor/property/' + this.dataModel.PropertyID;

    return this.http
      .get<any>(apiURL, { headers: { idtoken: Globals.getAuthToken() } })
      .subscribe(
        (data) => {
          if (data != null && data.data != null && data.isOK) {
            this.propertySubject.next({
              PropertyID: data.data.id,
              imageUrl: '/assets/images/property-coming-soon.jpg',
              Property: {
                Address: data.data.address.fullAddress,
                PricePerShare: data.data.pricePerShare,
                TotalSharesAvailable: data.data.totalSharesAvailable,
              },
              Quantity: 1,
            });
            console.log('Data from service', data.data);
          } else {
            console.log('loadPropertyData: Empty');
          }
        },
        (error) => {
          this.propertySubject.error(error);
          console.log('loadPropertyData: Error' + error);
        }
      );
  }
I want to subscribe in the component, and not in service, can you help me how to do that ?
Dominic Watson
@intellix
Salathiel Genèse
@SalathielGenese
I was never able to dive into the internals of Zone
But for what I know, it already handle a number of async operations
So I'd suspect that AWS SDK doesn't use standard promises !?
If you're able to determine that's the case, maybe just wrap it in normal promise API !?
robert-brower-impaq
@robert-brower-impaq
anybody else see these: zone.js:1752 [Violation] Added non-passive event listener to a scroll-blocking 'wheel' event. Consider marking event handler as 'passive' to make the page more responsive. See https://www.chromestatus.com/feature/5745543795965952
should I be concerned?
SeeeD
@SeeeD
Hey guys, I'm using jest for my unit tests (~1800 tests) and noted that there is a huge issue about memory leaks. The heap get's bigger and bigger by every test. Do you have recognized this in angular projects as well? If I search for it on the web I will see some postings, mostly about react or other frameworks.
Do you have any tip/idea how to improve the memory usage of it?
Adrijan Mahmuti
@adrijan.m_gitlab
image.png
hey anyone worked with chart js? i have used it in 3 different libraries when i navigate from 1 of them to another the values are shown twice on refresh everything works correctly
tried .destroy() as mentioned on documentation but not working for me
expected result is to show only the first one
like this
image.png
Aakash Giri
@0APOCALYPSE0
Hi, anyone used jsPDF? I am using jsPDF with html2canvas to generate pdf from html basically first i am creating canvas from html using html2canvas and then generating image from canvas and then just adding that image in pdf using jsPDF. So everything is working fine if i am generating pdf for small data, but if i am generating the pdf for large data then it is not generating pdf properly. Maybe because it is not able to create canvas after some px limits. So anyone have any idea why it is not working with large data or if you anyone have any other solution for generating pdf at client side. Thanks
Aakash Giri
@0APOCALYPSE0
Anyone has*
Carlos Gamboa
@CharlieUPB
Does anyone know how can I send an Object as input to an angular element? I dont want to send as string and then JSON.parse the input, because the object contains several special characters such as single quote, double quotes, backslashes, etc.
Salathiel Genèse
@SalathielGenese
Any issue with Angular @Input !?
robert-brower-impaq
@robert-brower-impaq
@0APOCALYPSE0 i have quite a lot
Are you having a problem with the page size and the images and whatnot?
you just have to figure out a clever way to make your hack work. Because that is what html2canvas and jsPDF are... quick hacks to solve the problem of having to pay for a real lib or api to do the same thing.
if you have a table that doesn'T fit on a printed page then you have to either split it up or scale it down.
faguilera85
@faguilera85
Hello everyone - can anyone advice me what's the best way to make several REST calls that are dependent on each other ? Thank you.
Salathiel Genèse
@SalathielGenese
What do you mean dependent on each other ?
HTTP protocol starts and stops connections independent of each others
So I'm really not sure what you mean
Patrick Collins
@patrick99e99
Hi everyone.. I am trying to upgrade an AngularJS app to Angular.. Following along various tutorials including the official upgrade guide. Basically everything is compiling w/ webpack properly, but none of my components are rendering. I made a simple component with a 'heading' selector and downgraded it, and in my mark up I still see <heading></heading> .. not rendering... So then I tried making an app-root component (not downgraded) to see if it would render, and I still see <app-root></app-root> .. the templates are not being placed inside the tags regardless of whether its downgraded or not.
Zerounodue
@Zerounodue

@faguilera85 probably you want to use concatMap(), you can use it like thi:

function getPersonByUserId(userId: number){
    return getUser(userId).pipe(
        concatMap(user => getPerson(user.id))
    );
}

where getUser() and getPerson() needs to be observables

zxvdgs
@zxvdgs:jonasled.de
[m]

unknow:matrix.org

Aakash Giri
@0APOCALYPSE0
@robert-brower-impaq yes, now i am creating multiple canvas and then generating images from them and then merging all these images together to get a final lengthy image. And then adding that image to jsPDF.
Amro al-Amir
@amr-alamir

hi there
I have a a library service which is provided in root.
I want to provide this service at component level
I tried

@Component({
  providers: [HotkeysService]
})

but the service still provided globally

Aakash Giri
@0APOCALYPSE0
You need to remove root in from service itself inside @injectable() decorator
I mean in other words your @injectable() decorator should be empty in service file @amr-alamir
Amro al-Amir
@amr-alamir
@0APOCALYPSE0 the problem is that I do not control the service
it is a third party service