Skip to content

Commit

Permalink
AngularJS Tutorial Part 1 - Creating a Hello World App
Browse files Browse the repository at this point in the history
  • Loading branch information
aashnisshah committed Aug 20, 2016
1 parent 20d6e94 commit 14dc5a4
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 0 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Original file line Diff line number Diff line change
@@ -1,2 +1,6 @@
# lsh_angularjs_tutorial # lsh_angularjs_tutorial
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/)
13 changes: 13 additions & 0 deletions app.js
Original file line number Original file line Diff line number Diff line change
@@ -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('/');
}
]);
7 changes: 7 additions & 0 deletions controllers/main.js
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,7 @@
angularApp.controller('MainCtrl', [
'$scope',
function($scope){
$scope.heading = "Hello World";
$scope.message = "This is me";
}
]);
22 changes: 22 additions & 0 deletions index.html
Original file line number Original file line Diff line number Diff line change
@@ -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>
2 changes: 2 additions & 0 deletions views/main.html
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,2 @@
<h1>{{ heading }}</h1>
<p>{{ message }}</h1>

0 comments on commit 14dc5a4

Please sign in to comment.