본문 바로가기
IT/JavaScript와 Framework

AngularJS 개요

by 골든크랩 2022. 2. 8.
728x90
반응형

 

AngularJS 는 동적인 웹 응용프로그램을 개발하기 위해 사용되는 프레임웍으로, 구글에서 MVC(Model-View-Controller) 라는 디자인 패턴을 기반으로 개발됨.

 

샘플예제)

 
 
<!DOCTYPE html>
<html ng-app="todoApp">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>TO DO List</title>
    <link href="bootstrap.css" rel="stylesheet" />
    <link href="bootstrap-theme.css" rel="stylesheet" />
    <script>
        var model = {
            user: "Adam",
            items: [{action: "Buy Flowers", done: false},
                    {action: "Get Shoes", done: false},
                    {action: "Collect Tickets", done: true},
                    {action: "Call Joe", done: false}]
        };

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

        todoApp.controller("ToDoCtrl", function ($scope) {
            $scode.todo = model;
        });
    </script>
    <style>
        html{border:5px solid red;}
        body{border:5px solid blue;}
        ol,ul{border: 5px solid green;text-align: center;}
        /* ol, ul 줄로서 여백 - 문단태그임(정렬 적용 가능) */
        li{border: 3px solid cyan;}
        /* 왼쪽에 기본 여백이 있음, 줄로서 여백(정렬 속성 적용 가능) */
    </style>  
</head>
<body ng-controller="ToDoCtrl">
    <div class="page-header">
        <h1>To Do List</h1>
    </div>
    <div class="panel">
        <div class = "input-group">
            <input class="form-control" />
            <span class="input-group-btn">
                <button class="btn btn-default">Addr</button>
            </span>
        </div>
    </div>
    <table class="table table-striped">
        <thead>
            <tr>
                <th>Description</th>
                <th>Done</th>
            </tr>
        </thead>
        <tbody></tbody>
    </table>    
</body>
</html>
728x90
반응형

댓글