How can I pass a parameter to a function using Angular Material Select with md-on-close?
When I try to log the parameter in my current code, it returns as undefined
.
This is what I have so far:
HTML
<md-input-container>
<label>Season</label>
<md-select name="season"
ng-model="cteam.season"
md-on-close="cteam.getid(season.$id)">
<md-option ng-repeat="season in cteam.seasons | orderBy: 'name'" value="{{season.name}}">
{{season.name}}
</md-option>
</md-select>
</md-input-container>
Controller
(function() {
angular
.module('app')
.controller('CreateTeamController', function() {
var vm = this;
vm.getid = function(id) {
console.log(id);
};
});
})();
Update (add app.js code)
(function() {
angular
.module('app', [
'ngRoute',
'ngMaterial',
'ngMessages',
'firebase'
])
.config(function($routeProvider, $mdThemingProvider){
$mdThemingProvider
.theme('default')
.primaryPalette('deep-purple');
$routeProvider
.when('/', {
templateUrl: 'views/main.html',
})
.when('/create/team', {
templateUrl: 'views/create-team.html',
controller: 'CreateTeamController',
controllerAs: 'cteam',
})
.otherwise({
redirectTo: '/',
});
});
})();