Permalink
Browse files

AngularJS Tutorial Part 1 - Creating a Hello World App

  • Loading branch information...
aashnisshah committed Aug 20, 2016
1 parent 20d6e94 commit 14dc5a4ac18510dc53906b8d162b91c9860abc66
Showing with 48 additions and 0 deletions.
  1. +4 −0 README.md
  2. +13 −0 app.js
  3. +7 −0 controllers/main.js
  4. +22 −0 index.html
  5. +2 −0 views/main.html
View
@@ -1,2 +1,6 @@
# lsh_angularjs_tutorial
LSH: AngularJS tutorial
These codes are part of an introduction to AngularJS tutorial by [Aashni Shah](http://www.aashni.me).
You can access the complete tutorial [here](http://blog.aashni.me/2016/08/angularjs-an-introduction/)
View
13 app.js
@@ -0,0 +1,13 @@
var angularApp = angular.module('AngularApp', ['ngRoute']);
angularApp.config(['$routeProvider',
function($routeProvider){
$routeProvider
.when('/', {
templateUrl : 'views/main.html',
controller : 'MainCtrl',
controllerAs : 'main'
})
.otherwise('/');
}
]);
View
@@ -0,0 +1,7 @@
angularApp.controller('MainCtrl', [
'$scope',
function($scope){
$scope.heading = "Hello World";
$scope.message = "This is me";
}
]);
View
@@ -0,0 +1,22 @@
<!DOCTYPE html>
<html ng-app="AngularApp">
<head>
<title>Star Wars App</title>
<!-- include AngualrJS js -->
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.0/angular.min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.0/angular-route.min.js"></script>
<!-- our files -->
<script type="text/javascript" src="app.js"></script>
<!-- Controllers -->
<script type="text/javascript" src="controllers/main.js"></script>
</head>
<body>
<div ng-view></div>
</body>
</html>
View
@@ -0,0 +1,2 @@
<h1>{{ heading }}</h1>
<p>{{ message }}</h1>

0 comments on commit 14dc5a4

Please sign in to comment.