Skip to content

Quick Start First application

Yana edited this page Mar 22, 2016 · 5 revisions

Quick Start

Setup

$ npm install -g generator-mcfly

Create Your First Application

$ mkdir my-new-project && cd $_
$ yo mcfly myapp

Follow instruction, in our sample we will use camelCase (see yo questions)

Add some contents

Add a controller

$ yo mcfly:module common
$ yo mcfly:controller common hello

Add some contents

in client/index.html

Add

<h2 ng-controller="main.common.hello as helloCtrl">{{helloCtrl.message}}</h2>

after <script src="scripts/bundle.js"></script>

in client/common/controllers/hello.controller.js

As you saw, in the last html snippet, we asked for a property called message in scope of main.common.hello, let's add it!

Let's add the following code in client/common/controllers/hello.controller.js, just after vm.controllername = fullname;:

vm.message = 'Hello World !!!';

Launch it!

$ gulp browsersync

or if you prefer (or have some problem with your default browser...)

$ gulp browsersync --no-browser

Tips: You can change the default browser in gulp_tasks/common/constants.js. Search for a browser property. Navigate to http://localhost:5000.

If all went well, we should see 'Hello World !!!' in your browser.