Created
September 9, 2015 17:01
-
-
Save iamdtang/5778bdddc8d70f111432 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
angular | |
.module('defaultValueSelect', []) | |
.controller('ExampleController', function($scope, someCalculationService) { | |
$scope.data = { | |
availableOptions: [ | |
{id: '1', name: 'Option A'}, | |
{id: '2', name: 'Option B'}, | |
{id: '3', name: 'Option C'} | |
], | |
selectedOption: {id: '3', name: 'Option C'} //This sets the default value of the select in the ui | |
}; | |
$scope.calculate = function(val) { | |
console.log('hey', $scope.data.selectedOption); | |
var calculatedData = someCalculationService.calculate($scope.data.selectedOption); | |
}; | |
}) | |
.factory('someCalculationService', function() { | |
return { | |
calculate: function() { | |
return []; | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment