Skip to content

Instantly share code, notes, and snippets.

@rrubiorr81
Created November 17, 2013 17:37
Show Gist options
  • Save rrubiorr81/7515899 to your computer and use it in GitHub Desktop.
Save rrubiorr81/7515899 to your computer and use it in GitHub Desktop.
Angular course notes
//angular course notes... 17/11/2013
//main include
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.0/angular.min.js"></script>
//defining the area where angular is going to look in...
<div ng-app> </div>
//inside this area u can do
<h2>{{2+5}}</h2> //and gets evalueted... or
<h2>{{"judith"+" the killer"}}</h2>
//the tags come "embeded" with natural html...
<input type="text" ng-model="nombrex" /> //and then u can prompt its content with
<h1>{{nombrex}}</h1> //for example...
//u can use regular html tags as angular components... for example, defining controllers ng-controller="contr1" and
//then implement the function with thtat name thats going to be called when changed the 'scope'
function contr1 ($scope) {
$scope.datax = {message: "hellow..."}
}
//then u can do
<div ng-controller="contr1">
<h1>{{datax.message + "world"}}</h1>
</div>
//when declaring ng-models, if u use an object like 'data.message' and u change it in different places, then its going
//to be overwritten (if u define the mopdel in a general scope). For the contrary, if used a simple variable, like 'message', its going to be overwritten and
//u'll get different outputs...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment