Expression in AngularJS
Expression is used to bind application data to HTML tags. Expression is written in {{expression}}. Expression has a similar way of operating as the ng-bind directive. The expressions in the AngularJS application are pure JavaScript expressions and the output is the data we use.
Use numbers in Expression in AngularJS:
Bookshelf: {{cost * quantity}} 000 VND
Use strings in Expression in AngularJS:
Hello {{student.firstname + "" + student.lastname}}!
Use objects in Expression in AngularJS:
Student ID: {{student.rollno}}
Use arrays in Expression in AngularJS:
Test Score (Tin): {{marks [3]}}
For example:
Below is an example for the expressions described above:
viduExpression.html
Examples of Expressions in AngularJS
QTM application
Hello {{student.firstname + "" + student.lastname}}!
Bookshelf: {{cost * quantity}} 000 VND
Student ID: {{student.rollno}}
Test Score (Tin): {{marks [3]}}
Result
Open the viduExpression.html page on the web browser and see the results below.
According to Tutorialspoint
Previous post: The Directive in AngularJS
Next lesson: Controller component in AngularJS
You should read it
May be interested
- Create the first AngularJS applicationto start, we start with creating the actual xinchao application by using angularjs, we will show you the specific parts of an angularjs application.
- Multilingual (i18n) in AngularJSangularjs provides multi-lingual functions (i18n) with 3 types of filters, currency, date and number. we just need to combine the js corresponding to the location depending on the country. by default it will attach to the location in the web browser.
- Controller component in AngularJSan angularjs application works primarily based on the controller component to control the flow of data in the application.
- MVC structure in AngularJSmodel view controller or mvc is a popular call, a software design model for web-based applications.
- Create the table in AngularJStable data is often repeated in natural order. in angularjs, ng-repeat directive can be used to draw tables easily. below is an example of how to use ng-repeat to create tables.
- Regular Expression in C #a regular expression is a pattern that can be matched to an input text. the .net framework provides a regular expression that allows matching like that. in c #, a pattern consists of one or more character constants, operators, or construct.
- Regular Expression in MongoDBregular expression is used frequently in all languages to search for a pattern or a word in any string. mongodb also provides regular expression to match pattern matching in string by using $ regex operator. mongodb uses pcre (perl compatible regular expression) as the regular expression language.
- Scope in AngularJSscope is a special javascript object with the role of linking controllers and views. scope contains information as model data. in the controller, model data can be accessed via the $ scope object.
- Regular Expression in PHPregular expression is nothing but a sequence or pattern of characters. they provide the basis for pattern matching.
- Regular Expression (RegEx) in Pythonregular expression (regex), also known as regular expression, is a segment of special characters that follow certain patterns.