Difference between revisions of "7CC005 Workshop w2"

From mi-linux
Jump to navigationJump to search
Line 40: Line 40:
 
* src/index.html
 
* src/index.html
 
* src/systemjs.config.js
 
* src/systemjs.config.js
 +
 +
=== index.html ===
  
 
<pre>
 
<pre>
Line 68: Line 70:
 
</html>
 
</html>
 
</pre>
 
</pre>
 +
 +
===systemjs.config.js===
  
 
<pre>
 
<pre>

Revision as of 16:51, 6 February 2017

Main Page >> Web Technologies >> Workbook >> Week 02 - Google Angular - part 1

Google Angular

You should spend 2 weeks working through The Tour of Heroes tutorial, located here:

It is recommended that you cover sections 1-4 this week:

  • 1. Introduction
  • 2. The Hero Editor
  • 3. Master/Detail
  • 4. Multiple Components

Base URL

When starting the application by typing:

npm start

You are given an IP address + port to access the app, for example:

[1] [BS] Access URLs:
[1]  --------------------------------------
[1]        Local: http://localhost:3002
[1]     External: http://134.220.4.152:3002
[1]  --------------------------------------
[1]           UI: http://localhost:3003
[1]  UI External: http://134.220.4.152:3003
[1]  --------------------------------------

But you may also want to deploy the application in your public_html folder, and browser to is via the domain name URL, for example mine is here:

To achieve this, you need to make a few changes to the following 2 files:

  • src/index.html
  • src/systemjs.config.js

index.html

<!DOCTYPE html>
<html>
  <head>
    <title>Angular QuickStart</title>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <base href="/~in9352/angular/quickstart/src/">
    <link rel="stylesheet" href="styles.css">

    <!-- Polyfill(s) for older browsers -->
    <script src="../node_modules/core-js/client/shim.min.js"></script>

    <script src="../node_modules/zone.js/dist/zone.js"></script>
    <script src="../node_modules/systemjs/dist/system.src.js"></script>

    <script src="systemjs.config.js"></script>
    <script>
      System.import('main.js').catch(function(err){ console.error(err); });
    </script>
  </head>

  <body>
    <my-app>Loading AppComponent content here ...</my-app>
  </body>
</html>

systemjs.config.js

(function (global) {
  System.config({
    paths: {
      // paths serve as alias
      'npm:': '../node_modules/'
    },

GitLab

Important: Make sure that you commit your work to GitLab on a regular basis!