Advertisement
Guest User

Untitled

a guest
Dec 2nd, 2016
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. <script src="https://cdnjs.cloudflare.com/ajax/libs/angular-ui-bootstrap/2.2.0/ui-bootstrap.js"></script>
  2. <script src="https://cdnjs.cloudflare.com/ajax/libs/angular-ui-bootstrap/2.2.0/ui-bootstrap-tpls.min.js" type="text/javascript"></script>
  3.  
  4. var app = angular.module('plunker', ['ui.bootstrap']);
  5.  
  6. angular
  7. .module('plunker')
  8. .factory('serviceModal', serviceModal);
  9.  
  10. serviceModal.$inject = [];
  11.  
  12. function serviceModal() {
  13. var opcoes = "";
  14.  
  15. return {
  16. setOpcoes: setOpcoes,
  17. getOpcoes: getOpcoes
  18. }
  19.  
  20. function setOpcoes(novasOpcoes) {
  21. this.opcoes = novasOpcoes;
  22. }
  23.  
  24. function getOpcoes() {
  25. if (this.opcoes === undefined) {
  26. this.opcoes = "";
  27. }
  28.  
  29. return this.opcoes;
  30. }
  31. }
  32.  
  33. .controller('MainCtrl', function($scope, $uibModal, $timeout, serviceModal)
  34.  
  35. serviceModal.setOpcoes($scope.data.opcoes);
  36.  
  37. $scope.verificarOpcoes = function() {
  38. var op = serviceModal.getOpcoes();
  39.  
  40. if (op !== undefined && op !== "") {
  41. return op.split(",");
  42. }
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement