Beginning AngularJS

(WallPaper) #1

Chapter 2 ■ the BasiCs of angularJs


Listing 2-6. A Quick Look at AngularJS Expressions


<!DOCTYPE html>




Listing 2-5



Expression Samples



6 + 4 = {{6 + 4}}



{{"Beginning AngularJS".toUpperCase()}}



{{"ABCDEFG".indexOf('D')}}



{{1==1? "Red" : "Blue"}}




There is nothing complex going on here. It’s all run-of-the-mill JavaScript code but now using AngularJS
expressions. Figure 2-4 shows the results.


Figure 2-4. AngularJS expressions in action


There are definitely a few more things to know about expressions, and we will get to them as you learn more
about how we should be structuring and organizing our code. This is exactly what I will discuss in the next chapter.

Free download pdf