Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <script src="https://code.jquery.com/jquery.min.js"></script>
  <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
  <script src="https://rawgit.com/angular/bower-angular/master/angular.min.js"></script>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>Angular Lesson</title>
</head>
<body ng-app="myApp">
  
  <div class="container" ng-controller="firstCtrl" >
    <p ng-show="visible">First element</p>
    <p ng-hide="visible">Second element</p>
    
    <ul>
      <li ng-repeat="el in list">{{ $index + 1 }}. {{ el }}</li>
    </ul>  
    
    <p>
      <input ng-model="name" class="form-input" type="text">
      <button ng-click="add()" class="btn btn-info btn-xs">Add</button> 
    </p>
    
    <p>{{ name }}</p>
    
  </div>
</body>
</html>
 
angular.module("myApp", [])
.controller("firstCtrl", function($scope) {
  $scope.visible = false;
  
  $scope.list = ["first", "second", "third"];
  
  $scope.name = "this is a example";
  
  $scope.add = function() {
    $scope.list.push($scope.name);
  };
})
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
gmitticapro
0viewers