본문 바로가기

AngularJS

AngularJS) directives, Expressions, Applications

AngularJS Introduction

ng-directives
- ng-app : defines an AngularJS application.
- ng-model : binds the value of HTML controls (input, select, textarea) to application data.
- ng-bind : binds application data to the HTML view.
- ng-init : initializes AngularJS application variables. 

//data-ng-를 ng- 대신 사용할 수 있음.

AngularJS Expressions

{{ expression }}

-AngularJS will "output" data exactly where the expression is written.
-AngularJS expressions bind AngularJS data to HTML 
the same way as the ng-bind directive.

AngularJS Applications

modules :  define AngularJS applications.

<div ng-app="myApp">...</div>

var app = angular.module('myApp', []);

controllers : control AngularJS applications.

<div ng-app="myApp" ng-controller="myCtrl">
{{ firstName + " " + lastName }}
</div>

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

app.controller('myCtrl', function($scope) {
  $scope.firstName= "John";
  $scope.lastName= "Doe";
});

'AngularJS' 카테고리의 다른 글

앵귤러JS (AngularJS)  (0) 2021.12.03