Wednesday 22 June 2016

start writing a project in yoman for angular js project

start writing a project in yeoman for angular js project

IN the app folder.

project structure is


1. images.
2. script
2.1 controller folder (all the controller are stored here.)
2.2 app.js (for routing the pages.)
3.style.
4. views. (all the static html stored here.)

create a module address.

1. Create a listItem in index.html in the navigation bar.
ex : <li><a ng-href="#/address">Address</a></li>

2. create a route in app.js

ex :

.when('/address', {
 templateUrl : 'views/address.html',
 controller : 'AdressCtrl',
 controllerAs : 'contact'
 })
3. create address.js in script/controller folder and write adress controller.
ex :
angular.module('scjavaApp')
.controller('AdressCtrl',function(){
console.log("Hhi this from controller");

});

4. In view folder create address.html
<div>
HI this from address page.
</div>

start grunt server and check

No comments:

Post a Comment