Curriculum
Course: AngularJS
Login

Curriculum

AngularJS

AngularJS Tutorial

0/65
Text lesson

AngularJS Strings

AngularJS strings are similar to JavaScript strings.

Example

<div ng-app=”” ng-init=”firstName=’John’;lastName=’Doe'”>

<p>The name is {{ firstName + ” ” + lastName }}</p>

</div>

AngularJS Objects

AngularJS objects are akin to JavaScript objects.

Example

<div ng-app=”” ng-init=”person={firstName:’John’,lastName:’Doe’}”>

<p>The name is {{ person.lastName }}</p>

</div>

AngularJS Arrays

AngularJS arrays are comparable to JavaScript arrays.

Example

<div ng-app=”” ng-init=”points=[1,15,19,2,40]”>

<p>The third result is {{ points[2] }}</p>

</div>

The same example can be demonstrated using ng-bind:

Example

<div ng-app=”” ng-init=”points=[1,15,19,2,40]”>

<p>The third result is <span ng-bind=”points[2]”></span></p>

</div>

AngularJS Expressions vs. JavaScript Expressions

Like JavaScript expressions, AngularJS expressions can include literals, operators, and variables, but they can be embedded within HTML. Unlike JavaScript expressions, AngularJS expressions do not support conditionals, loops, or exceptions. However, AngularJS expressions can utilize filters, which JavaScript expressions cannot.

For more details about JavaScript, check out our JavaScript Tutorial.