Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
Brad
@bradtaniguchi
I also assume it repeats every request call not matter what right?
and its the same request doubled up, not 2 different requests? (hard to tell in the SO post)
Hulkstance
@Hulkstance
@bradtaniguchi, Brad you are always right D:
did people tell that to you
Brad
@bradtaniguchi
I wish I was always right, would make winning the lotto very easy :P
Hulkstance
@Hulkstance
:smile: true
btw @bradtaniguchi, you can type that in the SO question and I will accept it
Brad
@bradtaniguchi
I'd just close it, your questions is missing the code for the interceptors (which are the root of the problem) so its "not a good SO question"
Hulkstance
@Hulkstance
they are in the stackblitz
Brad
@bradtaniguchi
Like in terms of helping someone in the future the question and my answer isn't helpful
Hulkstance
@Hulkstance
everything is there
Brad
@bradtaniguchi
I'd consider your post in the future, I'd say the question has a lot of "extra fluff" that wont help someone down the line. The answer is pretty straight forward (mis-use) but it would be hard for people to quickly skim to that part of the question and answer. That's how SO is suppose to work, now if thats a good thing is a different story :wink:
I answered it with what I knew. I'd update your question with the code snippet of the 2 interceptors so one doesn't have to go down the rabbit hole to see the code
Hulkstance
@Hulkstance
added only http-error.interceptor.ts's code because it was described that the problem was coming from there. Also, accepted it :)
image.png
the thing is why would "Status: OK" be an error
Brad
@bradtaniguchi
That is a different problem
Hulkstance
@Hulkstance
return Ok(new { Message = "Successfully registered." });. I forgot to add new { Message... part
SeeeD
@SeeeD
Hey guys, I'm using jest tests and run them via "ng test" command. I want to configure them to be run in webstorm, but I need to run "jest-preset-angular". Do you know any way to configure webstorm correctly to work well with jest? :-/
Nrwl/nx is linking the jest-preset-angular package within the angular.json - not in the jest.config.js
Hulkstance
@Hulkstance
btw, @bradtaniguchi, do you know what withCredentials: true does? Is it authorizing HTTP requests? Something like [AllowAnonymous] in ASP.NET Core.
Brad
@bradtaniguchi
@Hulkstance no idea what your refering to
benbotto
@benbotto
It automatically transmits cookies along with non-same-site XHR requests.
Although CORS applies to XHR requests, cookies, given there age, have strange legacy caveats (like different ports, subdomains, etc.).
SeeeD
@SeeeD
Does someone know if it is possible to spy whats happening when running jest test using "ng test libName"? It's very very slow and I want to find out why 🤔
Brad
@bradtaniguchi
@SeeeD You might be able to setup some profiling using Chrome inspect, only idea that came to my mind
Hulkstance
@Hulkstance
@benbotto, thanks
Weston
@ronnyek
nice! storybook mdx stuff looks good
now to convert my stories over, and then kick it into strictly docs mode
Weston
@ronnyek
also will be better when it can include props etc
Eugene Serkin
@jeserkin
Good evening.
Have a question about modules. I usually see, that class defined as a module is empty by itself. Only decorator is used for imports, etc. Is there any reason for that, or can one do some setup on that level as well?
Brad
@bradtaniguchi
@jeserkin What do you mean by "one do some setup on that level as well"?
Eugene Serkin
@jeserkin
e.g. since services (@Injectable) are of single instance cross entire application you can keep state in them. So for example I was thinking of setting some value for a service. And I want to do it on highest possible level. I was thinking about module. Inject service there through constructor, do my thing and Profit, so to say.
Brad
@bradtaniguchi
Oh, so inject a service into a module? Interesting, I never thought about doing that, but I'm not sure if thats possible
not sure about the idea of "setting some value for a service". How come you want to take this approach where you create a service then "do stuff" to it? There might be better patterns for what you want todo
Eugene Serkin
@jeserkin
Maybe. That's what I am wondering about.
It is possible to do that on Module level. I tried it. Just not sure, how good it is.
Brad
@bradtaniguchi
cool didn't know you could inject into a module haha! But yea whats your goal with taking the approach tho, I'm curious :)
Eugene Serkin
@jeserkin
So I decided to take all application service, that interact with BE into a separate library. One of services provide other services with URLs, but it needs base url, that is located inside environment.ts, that is located inside app. So for the purposes of not doing tight coupling, I though, that I can set this environment value in main application module and it will be present in any way.
Brad
@bradtaniguchi
I would leverage DI and make the base-url an injection token
that way you don't have to worry about declaring it in the correct module, DI will handle getting that information into the right places :)
You can still set it in the environment, but you can "provide" it to where you need it via creating your own injection token: https://angular.io/api/core/InjectionToken#plain-injectiontoken
Eric
@reallyimeric
Is it a bad practice to use result of function call as data-binding?
<test [size]="getSize()"></test> and public function getSize() { return 'large' }
Brad
@bradtaniguchi
@reallyimeric No, as long as the function isn't computation heavy. The example your giving should be fine as long as getSize isn't doing anything crazy
I should say if that is your actual function, don use a function tho :wink:
Eric
@reallyimeric
Yes I keep the function pure.
Brad
@bradtaniguchi
that shouldn't matter much, its just the function will be called every round of change detection. So it could be pure, but be called a lot. So making sure it isn't CPU intensive is important. onPush change detection should help as well, but the component might not work the same with that on unless you set it up that way initially