title: Angular 2 Ahead-of-Time compiler: must I make all class properties public?
body: <p><code>Angular 2 rc 6</code>, <code>typescript 2</code>, <code>node 4.5.0</code>, <code>npm 2.15.9</code> on <code>Windows 7</code></p>
  
  <p>I'm trying to move from Just-in-Time to Ahead-of-Time compilation and I'm relying on these resources:</p>
  
  <ul>
  <li><a href="https://stackoverflow.com/questions/38932193/angular-2-ahead-of-time-compilation-how-to">Angular 2 - Ahead-of-time compilation how to</a></li>
  <li><a href="https://github.com/angular/angular/tree/master/modules/@angular/compiler-cli#angular-template-compiler" rel="noreferrer">https://github.com/angular/angular/tree/master/modules/@angular/compiler-cli#angular-template-compiler</a></li>
  </ul>
  
  <p>I understand that I need to run the compiler <code>ngc</code> to generate <code>ngfactory.ts</code> files, and that I need to change <code>main.ts</code> to use <code>platformBrowser</code> instead of <code>platformBrowserDynamic</code> to bootstrap. I've hit a roadblock though and don't know how to proceed.</p>
  
  <p><strong>1.</strong> I've confirmed that the App runs without errors using Just-in-Time compilation. My <code>main.ts</code> is:</p>
  
  <pre><code>enableProdMode();
  platformBrowserDynamic().bootstrapModule(AppModule);
  </code></pre>
  
  <p><strong>2.</strong> I clear all my app files from my production folder, but keep 3rd party libraries (eg: Angular 2, Angular 2 Material)</p>
  
  <p><strong>3.</strong> I run <code>"node_modules/.bin/ngc" -p ./</code> This runs with no output to the console. I see an <code>.ngfactory.ts</code> file for each of my <code>.ts</code> components and modules. I also see a <code>.css.shim.ts</code> file for each of my <code>.css</code> that held component styles.  In addition, <code>.js</code> and <code>.js.map</code> files have been transpiled and placed in the production directory </p>
  
  <p><strong>4.</strong> If I try to run the app at this point, I see <code>404 not found</code> errors for all the <code>.html</code> files that held component templates</p>
  
  <p><strong>5.</strong> I manually move all template files (<code>.html</code>) to production dir and run the App. It runs fine, but it still uses Just-in-Time compilation (255 requests, including <code>compiler.umd.js</code>)</p>
  
  <p><strong>6.</strong> I change my <code>main.ts</code> to:</p>
  
  <pre><code>enableProdMode();
  platformBrowser().bootstrapModuleFactory(AppModuleNgFactory);
  </code></pre>
  
  <p>On its own, this makes no difference since the new code has not been compiled. However, I don't know what to do from here.</p>
  
  <p>Should I run <code>ngc</code> again? If so I get lots of errors of the type:</p>
  
  <pre><code>Error at C:/path/to/notify.component.ngfactory.ts:113:41: Property 'visible' is private and only accessible within class 'NotifyComponent'
  ... (many more like that with lots of properties from lots of components)
  Compilation failed
  </code></pre>
  
  <p>Does using AoT compilation mean that I must make all my class properties public? Am I missing a step?</p>