Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
Eric
@sliceofbytes
document.documentElement.style.setProperty('--some-variable', 'orange')
then in material scss just set the primary color to --some-variable etc...
David Stellini
@davidstellini
interesting - will try that
Eric
@sliceofbytes
Tanner B. Hess Webber
@Tbhesswebber

Is there a way to run ng g c person with a flag to only return impacted paths rather than <ACTION> path (size)?

I realize that this is a weird question, but I'm about to start teaching a course on Angular and want to do a brief dive into TS first. We'll be building a simple, immature VSCode extension that wraps the Angular CLI and I want to take created files from the generate command and open them. We could use RegEx, but that seems to be a potentially unstable solution...

Alibra
@thedubb
Hi All, I just wanted to ask if there was anyone here who has had success with implementing a component created using angular-cli using angular elements into another angular project? I can get this working locally but I can’t seem to get this working on production and I just wanted to see if there was anyone else who shared the same experience.
Eric
@sliceofbytes
@thedubb what error are you getting, would probably be more useful to fix your issue
Alibra
@thedubb

@sliceofbytes I’ve gone through a series of different errors but the I first ran into a zone.js error:

Uncaught Error: Zone.js has detected that ZoneAwarePromise `(window|global).Promise` has been overwritten.

Which I researched and found out that it’s better for angular components to use a push strategy for change detection so I removed zone.js from my component which got rid of that error.

Next error I received was:

Uncaught DOMException: Failed to execute 'define' on 'CustomElementRegistry': the name “app-my-button" has already been used with this registry

Which I was able to resolve with a check if (!customElements.get('element')) customElements.define('element', buttonElement);

Now that I’ve added that check, in production, my page does not load (no console errors either). Since I used angular CLI to create my elements project and combined all of my .js files into one, I’m thinking there must be some sort of conflict between my elements .js file and the .js file of the angular application that I’m using my element.js file in. I’ve been up for days trying to resolve this. I initially followed: https://blog.bitsrc.io/using-angular-elements-why-and-how-part-1-35f7fd4f0457 to create my web component (it’s more or less the same as other articles I’ve read). Locally everything runs as expected.

I should also mention that I’m using angular 8 for both my application and my web component
Eric
@sliceofbytes
@thedubb have you looked over the angular.io code that uses custom elements
I would follow their example
Alibra
@thedubb
thanks @sliceofbytes i’ve taken a look at angular.io but haven’t seen the link you posted, I’ll take a look at that.
matias-quezada
@matias-quezada

hey there, I'm having troubles with AOT and after hours of Googling I can't find a solution. Let me be concise, I load two different components depending on a property of environments

const routes = [{
  //...
  component: environment.foo ? FooComponent : BarComponent
}];

What's special in my project is that environment.ts file is lazy loaded, so same Docker container runs on different environments

// environment.ts
export const environment = (window as any).__env;

The issue is that when I run ng build with AoT enabled this is generated:

const routes = [{
  //...
  component: BarComponent
}];

It's like AoT is evaluating environment.foo on build time, can I prevent that?

ZBAGI
@ZBAGI
WTF
image.png
image.png
mikejf-pr
@mikejf-pr
Is there any reason not to just straight-up precompile polyfills and host them statically rather than building them every time?
Seems a waste
pardeep-cd
@pardeep-cd
Hi Guys,
The build command requires to be run in an Angular project, but a project definition could not be found.
i got this error while i was updating my angular project
Any one know why its showing this message
pardeep-cd
@pardeep-cd
Any Idea?
Aaron-Rhoades
@Aaron-Rhoades
ERROR in error TS2688: Cannot find type definition file for 'q'.
error TS2688: Cannot find type definition file for 'selenium-webdriver'.
Anyone else get the above error when running ng serve? It seems like whenever I delete node_modules and reinstall, that fixes the issue. But it always comes back after a computer reboot.
mikejf-pr
@mikejf-pr
Is there any way to call angular-cli from a node script? Or is it just use child_process.spawn
rvalimaki
@rvalimaki

@alan-agius4 Thanks a lot for angular/angular-cli#15453

Hopefully that's resolved one day. It's really ticking my nerves though :(

Luis Eduardo Jiménez Robles
@luisejrobles
Hi :wave:
i was trying to find something about i18n where I can contribute translating angular/cli docs to spanish
is that a necessary thing right no?
now*?
Lucas Granberg
@lucasgranberg
I am using ng build with --watch. Sometimes I do changes that are not picked up by this. Would it be possible to add a feature where you press (for example) enter and it would force rebuild without restarting the ng build command?
João Eduardo Soares e Silva
@joaodforce
I'm getting Unexpected value 'undefined' declared by the module when building to production using ng build --prod If I remove the --prod tag, it build normally.
the ofending module is FreBaseComponentsModule which is a module from my angular Library. It complains about in /Users/jed/Projects/Angular/angular-fre-base-components/dist/fre-base-components/fre-base-components.d.ts' but the file its only the typing exports, anyone got a clue about what could be causing this? I 've googled this but all the problems I've found were in different scenarios than mine.
ZBAGI
@ZBAGI

How can i run sed -i.compiler.bak 's/"packages\/\*\/src"/"dist\/packages\/\*"/' tsconfig.json in GNU bash but when i do

"scripts": {
    "tsconfig:set": "sed -i.compiler.bak 's/\"packages\\/\\*\\/src\"/\"dist\\/packages\\/\\*\"/' tsconfig.json",

it throws an error 'sed' is not recognized as an internal or external command, can i execute some bash script from npm

James Tikalsky
@jt2190

@ZBAGI Yes, you can run bash scripts from npm. Maybe try seeing what the environment for npm is by adding another entry to scripts:

“scripts”: {
  “env”: “env”
}

Then run:
npm run env (or perhaps npm run env | grep PATH)

James Scharett
@jscharett
anyone know if there are any vscode extensions for working with schematic .template files?
Jai Chandra
@jaichandra
Hi All,
I posted this in angular room, but I guess this belongs here:
I am getting below error since yesterday looks like some dependency update issue. Any help is appreciated.
ERROR: Unknown version 67 of android
An unhandled exception occurred: Unknown version 67 of android
See "/private/var/folders/3d/xqlw65w14z58l73ppm17kxth0000gp/T/ng-kDIunG/angular-errors.log" for further details.
DarkEdges
@darkedges
@jaichandra did you ever find a fix for your issue? I am experiencing the same after migrating from Angular 7 to 8
DarkEdges
@darkedges
@jaichandra I fixed it for me by removing my node_modules directory and reinstalling everything via npm install. Seems I had an incompatible version of autoprefixer somewhere
Richa Vyas
@richavyas
Hi, I am implementing ng update schematics for my library. I am wondering how it can be tested locally!!
Rémy Binsztock
@rbinsztock

Hi, I am currently working on a monorepository project with 6 libs inside /projects and one main application inside /src folder. When we want to develop something we need to start the library with ng build library-name --watch and in another terminal ng serve so when a change is made inside the library, the library will refresh and the main app will also refresh but we always need to save 3 or 4 times before the change are propagated to the main application. It's like the app refresh before the library and even after 2 refresh, it need more save to force another one refresh to see change in app.

Does anyone have an idea how to fix this problem ? Thank you ( We also disabled AOT has it slowdown the compile)

Rémy Binsztock
@rbinsztock
adding --poll=2000 flag into ng serve "fixed" the reload change
bradws
@bradws
I have uninstalled angular 7.x and node. Rebooted my Windows 7 box and re-installed latest stable of node and confirmed node and npm are installed (with the '-v' switch). Followed the normal steps to install angular (as per https://angular.io/guide/setup-local) and no errors, but when i do >ng new my-app in my Bash shell, it says: "Error: Cannot find module 'C:\Program Files\Git\node_modules\@angular\cli\bin\ng'"
Looking at my folder structure, there is no ''C:\Program Files\Git\node_modules" folder !?!
Eric
@sliceofbytes
@bradws you likely have a bad path variable for ng
try which ng in your cmd prompt
bradws
@bradws
which ng
shows "/c/Users/Brad/AppData/Roaming/npm/ng"
Eric
@sliceofbytes
that looks correct, try ng new testapp in your cmd prompt
bradws
@bradws
ng new testapp