Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <div ng-app="app" ng-controller="phonebookCtrl">
  
<form>
	<div class="row">
		<div class="small-3 columns">
			<label class="right inline">ФИО</label>
		</div>
		<div class="small-9 columns">
			<input type="text" ng-model="name" />
		</div>
	</div>
	<div class="row">
		<div class="small-3 columns">
			<label class="right inline">№ телефона</label>
		</div>
		<div class="small-9 columns">
			<input type="text" ng-model="phone" />
		</div>
	</div>
	<div class="row">
		<div class="small-3 columns">
			<label class="right inline">Эл. почта</label>
		</div>
		<div class="small-9 columns">
			<input type="text" ng-model="email" />
		</div>
	</div>
	<div class="row">
		<div class="small-3 columns"></div>
		<div class="small-9 columns">
			<button class="small radius" ng-click="addNewPerson()" ng-hide="currentPersonId > -1">Добавить</button>
			<button class="small radius" ng-click="savePerson()" ng-show="currentPersonId > -1">Сохранить</button>
		</div>
	</div>
</form>

<table id="phonebook">
<thead>
	<tr>
		<th>№</th>
		<th>ФИО</th>
		<th>№ телефона</th>
		<th>Эл. почта</th>
		<th></th>
	</tr>
</thead>
<tbody>
	<tr ng-repeat="person in phonebook">
		<td>{{ $index + 1 }}</td>
		<td>{{ person.name }}</td>
		<td>{{ person.phone }}</td>
		<td>{{ person.email }}</td>
		<td>
			<ul class="button-group radius">
				<li><button class="tiny radius" ng-click="editPerson($index)">ред-ть</button></li>
				<li><button class="tiny radius alert" ng-click="deletePerson($index)">удалить</button></li>
			</ul>
		</td>
	</tr>
</tbody>
</table>

</div>
              
            
!

CSS

              
                form {
  max-width: 500px;
  margin: 0 auto;
  padding-top: 20px;
}
form button.small {
  padding: 8px 17px;
}
#phonebook {
  margin: 0 auto;
}
#phonebook button.tiny {
  margin-bottom: 0;
  padding: 5px 10px;
}
              
            
!

JS

              
                var app = angular.module( 'app', [ ] )
.controller('phonebookCtrl', function( $scope ){
  $scope.currentPersonId = -1;
  $scope.phonebook = [
    {
      name: 'Чапаев Василий Иванович',
      phone: '+123-052-5555-234',
      email: 'vasiliy@chapaes.ru'
    }
  ];
  $scope.addNewPerson = function() {
    if ( $scope.name != '' ) {
      $scope.phonebook.push({
        name: $scope.name,
        phone: $scope.phone,
        email: $scope.email
      });
      $scope.name = '';
      $scope.phone = '';
      $scope.email = '';
    }
  }
  $scope.savePerson = function() {
    if( $scope.currentPersonId > -1 ){
      var id = $scope.currentPersonId;
      $scope.phonebook[id].name = $scope.name;
      $scope.phonebook[id].phone = $scope.phone;
      $scope.phonebook[id].email = $scope.email;
      $scope.name = '';
      $scope.phone = '';
      $scope.email = '';
      $scope.currentPersonId = -1;
    }
  }
  $scope.editPerson = function ( id ) {
    $scope.currentPersonId = id;
    $scope.name = $scope.phonebook[id].name;
    $scope.phone = $scope.phonebook[id].phone;
    $scope.email = $scope.phonebook[id].email;
  }
  $scope.deletePerson = function( id ) {
    $scope.phonebook.splice( id, 1 );
  }
})
              
            
!
999px

Console