I am working on an existing project of Angular 2. I added few modules on that project and on the files I added changes are not being detected.
I tried googling how these detect changes work in angular 2 but didn't get the right answer. Can anyone help me direct in which settings/files should I be looking into if I have to enable detect change and compile my new modules in Angular 2.
If you are running the angular cli you can run the command ng serve to detect changes and run your application at localhost:4200. Or you can run the command ng build --watch to observe changes. You will need to manually refresh the browser each time this recompiles.
Related
I've been running this code with Angular 4 no problem:
yarn sh-e2e --base-href='https://my-app.com'
sh-e2e is just configuring my settings for protractor testings. However, since I upgraded to Angular 8, I now keep seeing this error: Unknown option: '--base-href'
Most solutions I am seeing, are asking users to set the configurations in their Angular.json file, but I need to be able to set mine dynamically through the CLI. I am basically changing the --base-href based on which environment I am currently deploying in, and another variable.
I've been searching but can't seem to find how to reference the --base-href dynamically, without just setting something in the configuration file (which doesn't fix my problem). I need a command to allow me to set the testing url dynamically. Any help would be appreciated!
yarn sh-e2e --base-url='https://my-app.com'
Referencing it with --base-url instead of --base-href works with Angular 8!
I have the following setup:
A local UI library I'm developing
An Angular application that is consuming that library
I am using NPM link so that I don't have to publish the library every time I want to test changes in the application that is consuming it.
The Angular application is being served via the Angular CLI (ng serve --aot)
I am watching the UI library for changes so that it automatically builds using gulp watch
I have two problems:
Whenever I make a change to the library, gulp watch will trigger a new build. However, this build fails with the following error:
Error: EPERM: operation not permitted, unlink
I can solve this problem by triggering manual builds of the UI library, but there is another problem: the running application sees changes to the linked library, and triggers its own build as soon as the UI library build starts. This creates a race condition whereby the Angular CLI will not wait for the UI library to finish building.
What is the correct, standard way to watch for changes in a local NPM library, with an Angular CLI application, using NPM link?
I'm trying to create a run configuration in IntelliJ that will build my projects and run both ng serve (Angular CLI) and WebLogic Server simultaneously. I have installed the Multirun plugin in IntelliJ that allows multiple run configurations. I was able to create a run configuration for WebLogic Server however I cannot figure out a way to create a configuration that simply runs Angular CLI since it is ran through a command line.
Is there a plugin that I could use to initiate Angular CLI in intelliJ?
I ended up finding a solution to this issue. The only way that I could think of for running Angular CLI through a Run Configuration was to create a .cmd that opens up command prompt and starts the server. I stored this .cmd file within the project that needed Angular CLI and made that file my startup script in the WebLogic configuration. The same has to be done for the "Run" startup script and the "Debug" startup script.
When run (green arrow) is clicked, WebLogic runs inside of IntelliJ and a separate command prompt window opens and runs the Angular CLI.
I have an existing angular.js application, which I am in the process of upgrading to angular with NgUpgrade. I am also trying to move to using angular cli as the build system. ng serve and ng build works perfectly, but I am having trouble with ng build -prod.
For the orginal application, I used gulp for building, and as a intermediate step i transformed the input files with ng-annotate. I am having a hard time getting this to work with angular cli.
Is there any way to integrate ng-annotate with ng build -prod? Or any other way to process the angular.js files before minification?
I did this using babel-plugin-angularjs-annotate, which adds the annotations to the source files, in a permanent manner (so, you only need to run it once).
I put detailed instructions in this other SO post.
Notice Babel should not be added to your Angular project. Instead, you create a second project, and execute Babel in there. Babel will read the files from the folder you specify, and generate the annotated files in another folder you specify.
After you run this once, you can forget about ng-annotate.
I am working with ionic 2. And I don't know why when I'm trying to run 'ionic serve', it answer with the next messeges:
WARN: ionic.config.js has been deprecated, you can remove it.
WARN: No 'serve:before' gulp task found!
Your gulpfile contains a 'watch' task already! Add:
gulp.task('serve:before', ['watch']);
to your gulpfile to have Ionic CLI run 'watch' before serve.
WARN: ionic.config.js has been deprecated, you can remove it.
In the gulpfile.js I add that line and it works, but when I change some html file it don't update. I have to stop serve. And run the command again.
PD: I have alredy install all dependencies with npm install
Thanks
Recently Ionic updated their CLI tool (to beta.21). They have obviously made some changes in the gulp file which is being generated by their newly updated CLI. The project you are trying to run was created using an older version of CLI (probably beta.19). That's why you are getting that warning. Regarding the 'ionic.config.js has been deprecated' line, that file is simply a checkpoint to see whether you are using the latest version of Ionic CLI.
There is a quick fix (which I did).
1) Create a new ionic app (possibly using the same template as the one you are trying to run i.e., blank or sidemenu or tabs).
2) Copy the contents of the app directory of the project which you are trying to run to the app directory of the newly generated project.
(I don't know whether this is the right method, but this will work.)
Hope this helps you. Thanks.