main.controller.js 802 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. (function() {
  2. 'use strict';
  3. app.controller('Main', function($scope){
  4. console.log('ok')
  5. $scope.x = 1;
  6. $scope.x = 2;
  7. $scope.color = 'red';
  8. $scope.data = ['apple','oranges', 'banana'];
  9. $scope.sum = function() {
  10. $scope.result = $scope.x + $scope.y
  11. };
  12. $scope.addItem = function() {
  13. $scope.data.push($scope.item);
  14. $scope.item = '';
  15. };
  16. $scope.deleteItem = function(item){
  17. $scope.data.splice(item, 1);
  18. };
  19. $scope.style = {
  20. width: 100,
  21. height: 100,
  22. background: "red",
  23. display: "inline-block"
  24. };
  25. $scope.changeWidth = function() {
  26. $scope.style.width = $scope.width;
  27. };
  28. $scope.changeHeight = function() {
  29. $scope.style.height = $scope.height;
  30. };
  31. $scope.changeColor = function() {
  32. $scope.style.background = $scope.background;
  33. };
  34. })
  35. })();