Skip to content

Commit

Permalink
Understanding child scope
Browse files Browse the repository at this point in the history
  • Loading branch information
praneethkumarpidugu committed Jun 22, 2016
1 parent ae60dbb commit 50f0196
Show file tree
Hide file tree
Showing 142 changed files with 49,119 additions and 0 deletions.
3 changes: 3 additions & 0 deletions section4/.bowerrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"directory": "libs"
}
11 changes: 11 additions & 0 deletions section4/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Learn Real World AngularJS Step By Step by CodeCraft
http://codecraftpro.com

## Section 4 - Deep dive into scope

# Folders
./libs/ - The required libraries for all lectures in this course.
lesson1 - Starter template for lecture 1
lesson2 - Starter template for lecture 2
lesson3 - Starter template for lecture 3
completed - The completed application for this section
59 changes: 59 additions & 0 deletions section4/completed/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<!DOCTYPE html >
<html lang="en"
ng-app="codecraft" >
<head >
<title >Scope</title >
<link href="../libs/bootstrap/dist/css/bootstrap.min.css"
rel="stylesheet" >
<link href="main.css"
rel="stylesheet" >
</head >

<body >


<div class="container" >

<div class="row" >
<div class="col-md-6" >
<div class="root" >
<label >
<input type="text"
ng-model="data.name" />
</label >
<p >{{data.name}}</p >

<div class="row" >
<div class="" >
<div class="parent"
ng-controller="ParentController" >
<label >
<input type="text"
ng-model="data.name" />
</label >
<p >{{data.name}}</p >

<div class="child"
ng-controller="ChildController" >
<label >
<input type="text"
ng-model="data.name" />
</label >
<button class="btn"
ng-click="reset()" >Reset
</button >
<p >{{data.name}}</p >
</div >

</div >
</div >
</div >
</div >
</div >
</div >
</div >

<script src="../libs/angular/angular.min.js" ></script >
<script src="main.js" ></script >
</body >
</html >
46 changes: 46 additions & 0 deletions section4/completed/main.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
body {
padding-top: 50px;
}
.main-content {
padding: 40px 15px;
}

.root, .parent, .child {
padding: 40px
}

.root {
background-color: rgba(172, 172, 172, 0.55);
}

.parent {
background-color: rgb(56, 126, 245);
}

.child {
background-color: rgba(0, 255, 10, 0.54);
}

p {
color: white;
}

input {
margin-bottom: 10px;
display: block;
width: 100%;
height: 34px;
padding: 6px 12px;
font-size: 14px;
line-height: 1.42857143;
color: #555;
background-color: #fff;
background-image: none;
border: 1px solid #ccc;
border-radius: 4px;
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
-webkit-transition: border-color ease-in-out .15s, -webkit-box-shadow ease-in-out .15s;
-o-transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
}
19 changes: 19 additions & 0 deletions section4/completed/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
var app = angular.module('codecraft', []);

app.controller('ParentController', function ($scope, $rootScope) {
//
//$scope.reset = function () {
// $scope.name = "Parent";
//};

});

app.controller('ChildController', function ($scope, $rootScope) {

//$scope.reset = function () {
// $rootScope.name = "Reset By Child";
//};

});


45 changes: 45 additions & 0 deletions section4/lesson1/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<!DOCTYPE html >
<html lang="en"
ng-app="codecraft" >
<head >
<title >Scope</title >
<link href="../libs/bootstrap/dist/css/bootstrap.min.css"
rel="stylesheet" >
<link href="main.css"
rel="stylesheet" >
</head >

<body >


<div class="container" >

<div class="row" >
<div class="col-md-6" >
<div class="parent"
ng-controller="ParentController" >
<label >
<input type="text"
ng-model="name" />
</label >
<p >{{name}}</p >
<div class="child"
ng-controller="ChildController">
<label>
<input type="text" ng-model="name" />
</label>
<!-- reset is on parent controller -->
<button class="btn" ng-click="reset()">Reset</button>
<p>{{name}}</p>

</div>
</div >
</div >
</div >
</div >


<script src="../libs/angular/angular.min.js" ></script >
<script src="main.js" ></script >
</body >
</html >
46 changes: 46 additions & 0 deletions section4/lesson1/main.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
body {
padding-top: 50px;
}
.main-content {
padding: 40px 15px;
}

.root, .parent, .child {
padding: 40px
}

.root {
background-color: rgba(172, 172, 172, 0.55);
}

.parent {
background-color: rgb(56, 126, 245);
}

.child {
background-color: rgba(0, 255, 10, 0.54);
}

p {
color: white;
}

input {
margin-bottom: 10px;
display: block;
width: 100%;
height: 34px;
padding: 6px 12px;
font-size: 14px;
line-height: 1.42857143;
color: #555;
background-color: #fff;
background-image: none;
border: 1px solid #ccc;
border-radius: 4px;
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
-webkit-transition: border-color ease-in-out .15s, -webkit-box-shadow ease-in-out .15s;
-o-transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
}
15 changes: 15 additions & 0 deletions section4/lesson1/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
var app = angular.module('codecraft', []);

app.controller('ParentController', function ($scope) {
$scope.name = "Parent";

$scope.reset = function () {
$scope.name = "Parent";
};

});

app.controller('ChildController', function ($scope) {
});


48 changes: 48 additions & 0 deletions section4/lesson2/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<!DOCTYPE html >
<html lang="en"
ng-app="codecraft" >
<head >
<title >Scope</title >
<link href="../libs/bootstrap/dist/css/bootstrap.min.css"
rel="stylesheet" >
<link href="main.css"
rel="stylesheet" >
</head >

<body >


<div class="container" >

<div class="row" >
<div class="col-md-6" >
<div class="parent"
ng-controller="ParentController" >
<label >
<input type="text"
ng-model="name" />
</label >
<p >{{name}}</p >

<div class="child"
ng-controller="ChildController" >
<label >
<input type="text"
ng-model="name" />
</label >
<button class="btn"
ng-click="reset()" >Reset
</button >
<p >{{name}}</p >
</div >

</div >
</div >
</div >
</div >


<script src="../libs/angular/angular.min.js" ></script >
<script src="main.js" ></script >
</body >
</html >
46 changes: 46 additions & 0 deletions section4/lesson2/main.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
body {
padding-top: 50px;
}
.main-content {
padding: 40px 15px;
}

.root, .parent, .child {
padding: 40px
}

.root {
background-color: rgba(172, 172, 172, 0.55);
}

.parent {
background-color: rgb(56, 126, 245);
}

.child {
background-color: rgba(0, 255, 10, 0.54);
}

p {
color: white;
}

input {
margin-bottom: 10px;
display: block;
width: 100%;
height: 34px;
padding: 6px 12px;
font-size: 14px;
line-height: 1.42857143;
color: #555;
background-color: #fff;
background-image: none;
border: 1px solid #ccc;
border-radius: 4px;
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
-webkit-transition: border-color ease-in-out .15s, -webkit-box-shadow ease-in-out .15s;
-o-transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
}
15 changes: 15 additions & 0 deletions section4/lesson2/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
var app = angular.module('codecraft', []);

app.controller('ParentController', function ($scope) {
$scope.name = "Parent";

$scope.reset = function () {
$scope.name = "Parent";
};

});

app.controller('ChildController', function ($scope) {
});


0 comments on commit 50f0196

Please sign in to comment.