AngularJS_1
[AngularJS] 13.5 API - AngularJS 강좌
날아올라↗↗
2016. 6. 14. 13:37
728x90
반응형
AngularJS API
1. AngularJS Global API
AngularJS Global API는 아래와 같은 일을 수행하기 위한 global 자바스크립트 함수의 집합입니다:
- 객체 비교
- 객체 열거
- 데이터 변환
Global API 함수는 angular 객체를 사용하여 접근됩니다.
API | Description |
---|---|
angular.lowercase() | Converts a string to lowercase |
angular.uppercase() | Converts a string to uppercase |
angular.isString() | Returns true if the reference is a string |
angular.isNumber() | Returns true if the reference is a number |
[출처: W3Schools ]
1-1. angular.lowercase()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | <!DOCTYPE html> <html> <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script> <body> <div ng-app="myApp" ng-controller="myCtrl"> <p>{{ x1 }}</p> <p>{{ x2 }}</p> </div> <script> var app = angular.module('myApp', []); app.controller('myCtrl', function($scope) { $scope.x1 = "JOHN"; $scope.x2 = angular.lowercase($scope.x1); }); </script> </body> </html> | cs |
1-2. angular.uppercase()
1 2 3 4 5 6 7 8 9 10 11 12 13 | <div ng-app="myApp" ng-controller="myCtrl"> <p>{{ x1 }}</p> <p>{{ x2 }}</p> </div> <script> var app = angular.module('myApp', []); app.controller('myCtrl', function($scope) { $scope.x1 = "John"; $scope.x2 = angular.uppercase($scope.x1); }); </script> | cs |
1-3. angular.isString()
1 2 3 4 5 6 7 8 9 10 11 12 | <div ng-app="myApp" ng-controller="myCtrl"> <p>{{ x1 }}</p> <p>{{ x2 }}</p> </div> <script> var app = angular.module('myApp', []); app.controller('myCtrl', function($scope) { $scope.x1 = "JOHN"; $scope.x2 = angular.isString($scope.x1); }); </script> | cs |
1-4.angular.isNumber()
1 2 3 4 5 6 7 8 9 10 11 12 | <div ng-app="myApp" ng-controller="myCtrl"> <p>{{ x1 }}</p> <p>{{ x2 }}</p> </div> <script> var app = angular.module('myApp', []); app.controller('myCtrl', function($scope) { $scope.x1 = "JOHN"; $scope.x2 = angular.isNumber($scope.x1); }); </script> | cs |
* 이 강좌는 w3schools를 참고하여 작성하였습니다.
728x90
반응형