0

I've been given an Angular project that I am trying to understand. For now I am able to start the project with the command "gulp serve" and then I can browse to the development server from Chrome with "http://localhost:3000".

When I search for all "ng-app" directives (from Visual Studio Code) I can only see some that are in 3 files named "vendor.bundle.js.map".

I thought that there should be at least one index.html file that would have this directive...

If you have any clue on this... Thanks !

Frank Modica
  • 10,238
  • 3
  • 23
  • 39
  • Why would you expect there to be ng-app directives? The app is typically being bootstrapped in a file called main.ts. I assume that's what you're looking for. – Arne Nov 21 '18 at 16:16
  • 1
    Is this AngularJS (Angular 1)? `angular.bootstrap` is another way to initialize the app. Check out https://docs.angularjs.org/api/ng/function/angular.bootstrap – Frank Modica Nov 21 '18 at 16:16
  • No, it is Angular 1.7.5 ; There is one index.html file with only directives ng-strict-di and ng-cloack and there are 3 folders and in one of them there is an app.js file that contains one line beginning with : "let appModule = angular.module('app', [.....]);" ; Should I consider this line as the entry point of the Angular app ? Thanks ! –  Nov 21 '18 at 16:21
  • By AngularJS (Angular 1) I meant any version like Angular 1.X, so yeah it's AngularJS. What are the 3 occurrences of `ng-app` doing? – Frank Modica Nov 21 '18 at 16:47
  • Ok, sorry, yes you are right, it is version 1.x. There is no occurrence of "ng-app" but only one app.js file ; And this app.js file contains one line with "let appModule..." as I wrote previously :) –  Nov 21 '18 at 16:52
  • As I understand things, the index.html file containing the directive "ng-strict-di" forces the app not to show up before everything is loaded in the DOM, and then the entry point ("let appModule...") is executed. Isn't that ? Thanks. –  Nov 21 '18 at 16:55
  • Oh sorry, when you wrote `When I search for all "ng-app" directives (from Visual Studio Code) I can only see some that are in 3 files named "vendor.bundle.js.map"` I didn't realize that's vendor code (I thought maybe some weird JS was there that was setting `ng-app`). Usually `let appModule = ...` code is combined with `ng-app` or a call to `angular.bootstrap`. – Frank Modica Nov 21 '18 at 17:00
  • So, as there are no "ng-app" in the main project files (apart in vendor.bundle.js.map) I think that the "let appModule =..." is replacing the use of "ng-app" directive. Is that right ? –  Nov 21 '18 at 17:08
  • As far as I know, `angular.module(...)` gets combined with something else, either `ng-app` or `angular.bootstrap`. – Frank Modica Nov 21 '18 at 17:14
  • Ok, I see. In the same app.js file there is the following part : `appModule.component('app', AppComponent); angular.element(document).ready(function () { angular.bootstrap(document, ['app']); });` –  Nov 22 '18 at 08:16
  • I have put a "alert(1);" in this block of code and the alert box shows up when accessing the project after deploying it with "gulp serve" and accessing it from Chrome. That's good, I have my entry point ! Thanks !! –  Nov 22 '18 at 09:30

1 Answers1

0

It is because the use of "let appModule = angular.module('app', [.....]);" that replaces the use of "ng-app" directive.