<commit_before>---
title: Angular.js
layout: default
---

    <html ng-app="nameApp">

### Lists (ng-repeat)

    <ul ng-controller="MyListCtrl">
      <li ng-repeat="phone in phones">
        {{phone.name}}
      </li>
    </ul>

### Model (ng-model)

    <select ng-model="orderProp">
      <option value="name">Alphabetical</option>
      <option value="age">Newest</option>
    </select>

### Defining a module

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

    App.controller('MyListCtrl', function ($scope) {
      $scope.phones = [ ... ];
    });

### Controller with protection from minification

    App.controller('Name', [
      '$scope',
      '$http',
      function ($scope, $http) {
      }
    ]);

    a.c 'name', [
      '$scope'
      '$http'
      ($scope, $http) ->
    ]

### Service

    App.factory('NameService', function($http){
      return {
        get: function(){
          return $http.get(url);
        }
      }
    });

In controller you call with parameter and will use promises to return data from server.

    App.controller('controllerName',
    function(NameService){
      NameService.get()
      .then(function(){})
    })

### Directive

    App.directive('name', function(){
      return {
        template: '<h1>Hello</h1>'
      }
    });

In HTML will use `<name></name>` to render your template `<h1>Hello</h1>`

### HTTP

  App.controller('PhoneListCtrl', function ($scope, $http) {
    $http.get('/data.json').success(function (data) {
      $scope.phones = data;
    })
  });

References:

 * https://github.com/angular/angular-seed
 * https://angularjs.org/
<commit_msg>factory -> service (service)<commit_after>---
title: Angular.js
layout: default
---

    <html ng-app="nameApp">

### Lists (ng-repeat)

    <ul ng-controller="MyListCtrl">
      <li ng-repeat="phone in phones">
        {{phone.name}}
      </li>
    </ul>

### Model (ng-model)

    <select ng-model="orderProp">
      <option value="name">Alphabetical</option>
      <option value="age">Newest</option>
    </select>

### Defining a module

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

    App.controller('MyListCtrl', function ($scope) {
      $scope.phones = [ ... ];
    });

### Controller with protection from minification

    App.controller('Name', [
      '$scope',
      '$http',
      function ($scope, $http) {
      }
    ]);

    a.c 'name', [
      '$scope'
      '$http'
      ($scope, $http) ->
    ]

### Service

    App.service('NameService', function($http){
      return {
        get: function(){
          return $http.get(url);
        }
      }
    });

In controller you call with parameter and will use promises to return data from server.

    App.controller('controllerName',
    function(NameService){
      NameService.get()
      .then(function(){})
    })

### Directive

    App.directive('name', function(){
      return {
        template: '<h1>Hello</h1>'
      }
    });

In HTML will use `<name></name>` to render your template `<h1>Hello</h1>`

### HTTP

  App.controller('PhoneListCtrl', function ($scope, $http) {
    $http.get('/data.json').success(function (data) {
      $scope.phones = data;
    })
  });

References:

 * https://github.com/angular/angular-seed
 * https://angularjs.org/

{'fraction_non_alphanumeric': 0.18293809670465044, 'fraction_numerical': 0.0024638127502309825, 'mean_word_length': 2.4516471838469713, 'pattern_counts': {'":': 0, '<': 37, '<?xml version=': 0, '>': 40, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4641083', 'n_tokens_mistral': 1044, 'n_tokens_neox': 1010, 'n_words': 218}