Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<script src="https://rawgit.com/angular/bower-angular/master/angular.min.js"></script>
  <script src="//jashkenas.github.io/underscore/underscore-min.js"></script>
  <meta charset="utf-8">
  <title>JS Bin</title>
</head>
<body ng-app="app">
  
  <div ng-controller="control1">
    <h2>Controller #1</h2>
    <p>Apenas um {{teste}}</p>
    <pre>{{teste|json}}</pre>
    
  </div>
  
</body>
</html>
 
angular.module('app', [])
.controller('control1', function($scope, shared){
  shared.set({
    teste1: "Apenas um teste",
    teste2: "Apenas outro teste",
    teste3: "Segundo teste"
  
  });
  
  $scope.teste = shared.get('teste1');
})
.factory('shared', function() {
    var items = [];
    //var myBasketService = {};
    this.set = function(item) {
        items.push(item);
    };
    this.get = function(key) {
        if(key) return _.pluck(items, key);
        else return items[0];
    };
    return this;
});
Output 300px

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

Dismiss x
public
Bin info
anonymouspro
0viewers