title: Angular2 Uncaught ReferenceError: Class is not defined
body: <p>I am learning <code>Angular2</code> using <code>JavaScript</code>(No TypeScript) with the help of <a href="https://www.youtube.com/watch?v=Ne3shVOonwo" rel="nofollow">this video</a>. The code worked fine, until I started using a <code>service</code>. It starts to give me the following error - </p>
  
  <pre><code>Uncaught ReferenceError: Class is not defined
  </code></pre>
  
  <p>I understand that Class is not defined in JavaScript, but I assume that it's a part of Angular2 library. Here's my complete app.js code - </p>
  
  <pre><code>(function() {
      var Component = ng.core.Component;
      var bootstrap = ng.platformBrowserDynamic.bootstrap;
      var QuoteService = Class({
          constructor:function () {
              this.quotes = quotes;
          },
          getRandomQuote: function (params) {
            var randomIndex = Math.floor(Math.random()*quotes.length);
              return this.quotes[randomIndex];
          }
      });
  
      var RandomQuoteComponent = Component({
          selector:'random-quote',
          template:'&lt;em&gt;{{quote.line}}&lt;/em&gt; - {{quote.author}}'
      })
      .Class({
          constructor:function () {
              var quoteService = new QuoteService();
              this.quote = quoteService.getRandomQuote();
          }
      });
  
      var AppComponent = Component({
          selector: 'my-app',
          directives:[RandomQuoteComponent],
          template: 
          '&lt;h1&gt;Random Quotes&lt;/h1&gt;'+
          '&lt;p&gt;&lt;random-quote&gt;&lt;/random-quote&gt;&lt;/p&gt;'
      })
      .Class({
          constructor: function () {
              //empty
          }
      });
  
      document.addEventListener('DOMContentLoaded',function () {
          bootstrap(AppComponent);
      })
      var quotes = [
      {
        "line": "Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.",
        "author": "Brian W. Kernighan"
      },
      {
        "line": "Walking on water and developing software from a specification are easy if both are frozen.",
        "author": "Edward V Berard"
      },
      {
        "line": "It always takes longer than you expect, even when you take into account Hofstadter's Law.",
        "author": "Hofstadter's Law"
      },
      {
        "line": "Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.",
        "author": "Rick Osborne"
      },
      {
        "line": "In theory, there is no difference between theory and practice. But, in practice, there is.",
        "author": "Jan L. A. van de Snepscheut"
      },
      {
        "line": "Measuring programming progress by lines of code is like measuring aircraft building progress by weight.",
        "author": "Bill Gates"
      },
      {
        "line": "There are 2 hard problems in computer science: cache invalidation, naming things, and off-by-1 errors.",
        "author": "Leon Bambrick"
      },
      {
        "line": "Nine people can't make a baby in a month.",
        "author": "Fred Brooks"
      },
      {
        "line": "If debugging is the process of removing software bugs, then programming must be the process of putting them in.",
        "author": "Edsger Dijkstra"
      },
      {
        "line": "The first 90% of the code accounts for the first 90% of the development time. The remaining 10% of the code accounts for the other 90% of the development time.",
        "author": "Tom Cargill"
      }
    ];
  })();
  </code></pre>
  
  <p>This line <code>var QuoteService = Class({...});</code> is responsible for this error. Any idea what could be going wrong in this case?</p>