+ All Categories
Home > Technology > Angular JS, steal the idea

Angular JS, steal the idea

Date post: 21-Jul-2015
Category:
Upload: scott-lee
View: 113 times
Download: 1 times
Share this document with a friend
23
STEAL THE IDEA SCOTT LEE APRIL 12 2015
Transcript
Page 1: Angular JS, steal the idea

STEAL THE IDEA

SCOTT LEE

APRIL 12 2015

Page 2: Angular JS, steal the idea
Page 3: Angular JS, steal the idea

HTTP://WWW.TUTORIALSPOINT.COM/ANGULARJS/INDEX.HTM

Index.html

Page 4: Angular JS, steal the idea

SET UP

http://www.sublimetext.com/

Page 5: Angular JS, steal the idea
Page 6: Angular JS, steal the idea

NEW LANGUAGE

•How to transfer data?

•How to manipulate data?

•How to reuse codes?

•How to control complex logic?

•How to organize codes?

•How to let developer build code easily

Page 7: Angular JS, steal the idea

Watch

demo Simpl

e App

Dig

Understand

Apply

Page 8: Angular JS, steal the idea
Page 9: Angular JS, steal the idea

Java Script (showInput.html)<html>

<head>

</head>

<body>

<script type="text/javascript">

function changeThis() {

var formInput = document.getElementById('theInput').value;

document.getElementById('newText').innerHTML = formInput;

}

</script>

Input something in the input box:

<p>

<input type='text' id='theInput' value='Write here' />

<input type='button' onclick='changeThis()' value='Enter' />

<p>You wrote: <span id='newText'></span> </p>

<a href="index.html">angularJS</a>

</body>

</html>

Page 10: Angular JS, steal the idea

AngularJS (index.html)

<!DOCTYPE html>

<html>

<head>

<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script>

</head>

<body>

<div ng-app="">

<p>Input something in the input box:</p>

<p>Name:

<input type="text" ng-model="name">

</p>

<p ng-bind="name"></p>

</div>

</body>

</html>

Page 11: Angular JS, steal the idea

CONTROLLER DEMO

Page 12: Angular JS, steal the idea

DESIGN POINTS• FUNCTION CONTROLLER

• APPLICATION MODULE

var mainapp = angular.module("mainapp", []);

mainapp.controller('studentcontroller', function($scope) {

$scope.student = {

firstname: “scott",

lastname: “lee",

fullname: function() {

var studentObject;

studentObject = $scope.student;

return studentObject.firstname + " " + studentObject.lastname;

}

};

});

Page 13: Angular JS, steal the idea

Module

Controllerfuncti

on

Page 14: Angular JS, steal the idea

<script>angular.module("myapp", []).controller("HelloController",

function($scope) {$scope.helloTo = {};$scope.helloTo.title = "AngularJS";

});</script>

Page 15: Angular JS, steal the idea

CODE ORGANIZATIO

N

app/----- controllers/---------- mainController.js---------- otherController.js----- directives/---------- mainDirective.js---------- otherDirective.js----- services/---------- userService.js---------- itemService.js----- js/---------- bootstrap.js---------- jquery.js----- app.jsviews/----- mainView.html----- otherView.html----- index.html

Page 16: Angular JS, steal the idea

SUMMARY

•How to transfer data? ng-bind, $scope

•How to manipulate data? ng-filter

•How to reuse codes? ng-template, service, Dependency Injection

•How to control complex logic? ng-controller, module, ng-route, ng-app

•How to organize codes? MVC

•How to let developer build code easily? directives

Page 17: Angular JS, steal the idea
Page 18: Angular JS, steal the idea
Page 19: Angular JS, steal the idea

Data-binding: It is the automatic synchronization of data between model and view components.Scope: These are objects that refer to the model. They act as a glue between controller and view.Controller: These are Javascript functions that are bound to a particular scope.Services: AngularJS come with several built-in services for example $http to make a XMLHttpRequests. These are singleton objects which are instantiated only once in app.Filters: These select a subset of items from an array and returns a new array.Directives: Directives are markers on DOM elements (such as elements, attributes, css, and more). These can be used to create custom HTML tags that serve as new, custom widgets. AngularJS has built-in directives (ngBind, ngModel...)Templates:These are the rendered view with information from the controller and model. These can be a single file (like index.html) or multiple views in one page using "partials".Routing: It is concept of switching views.Model View Whatever: MVC is a design pattern for dividing an application into different parts (called Model, View and Controller), each with distinct responsibilities. AngularJS does not implement MVC in the traditional sense, but rather something closer to MVVM (Model-View-ViewModel). The Angular JS team refers it humorously as Model View Whatever.

Page 20: Angular JS, steal the idea

EVALUATE

•FAST RESPONSE

•SIMPLIFIED CODE

•ORGANIZE CODES

Page 21: Angular JS, steal the idea

RESPONSIVE WEB PAGE

•Single Page Application

•Rich browser logic

•RESTful API

Page 22: Angular JS, steal the idea

FURTHER STUDY

Page 23: Angular JS, steal the idea

NEXT TOPIC

• MongoDB

• Ruby On Rail

• ExpressJS

• NodeJS


Recommended