AngularJs Drop-down Get Selected Items Value

How to get selected drop-down value in angularjs?

The JavaScript code sample as given below.

var app = angular.module('addConnectionApp', [])
app.controller('addConnectionCtrl', function ($scope) {
    $scope.companies = [{
        id: '1',
        name: 'ViaIndia'
    }, {
        id: '2',
        name: 'Invia'
    }, {
        id: '3',
        name: 'Dominos'
    }, {
        id: '4',
        name: 'Pizza'

    $scope.tents = [{
        id: '1',
        name: 'Optus'

    $scope.fName = null;
    $scope.lName = null;
    $ = null;
    $ = null;
    $scope.tenantId = 1;//This is defeult selected item.
    $scope.companyId = 1;//This is defeult selected item.
    $scope.accountNo = null;
    $scope.imsi = null;
    $scope.imei = null;
    $scope.message = null;

    $scope.addServices = function () {
        var self = $scope;
        var service = {
            FirstName: self.fName,
            LastName: self.lName,
            IMSI: self.imsi,
            IMEI: self.imei,
            AccountNo: self.accountNo,
            Region: self.accountNo,
            TenantID: self.tenantId,
            CompanyID: self.companyId

The HTML code sample as given below.

<div class="row" ng-app="addConnectionApp" ng-controller="addConnectionCtrl">
<div class="large-12 columns">
<div class="row">
<div class="large-12 columns">
<h1 class="heading-primary">New Connection</h1>
<div class="intro-primary">                 
<input type="text" ng-model="fName" placeholder="First Name" required />
<input type="text" ng-model="lName" placeholder="Last Name" required />
<input type="number" ng-model="mobile" maxlength="12" placeholder="MobileNo" required />
<select ng-model="tenantId">
    <option data-ng-repeat="ten in tents" value="{{}}">{{}}</option>
<select ng-model="companyId">
    <option data-ng-repeat="comp in companies" value="{{}}">{{}}</option>
<input type="text" ng-model="accountNo" placeholder=" company account no." required />
<input type="email" ng-model="email" placeholder="Email" required />
<input type="text" ng-model="imsi" placeholder="IMSI" required />
<input type="text" ng-model="imei" placeholder="IMEI" required />
<textarea ng-model="message" placeholder="Message"></textarea>
<div class="hide-for-small">
    <a class="button radius small yellow right" ng-click="addServices();">Create New Connection</a>


Hey! I'm Anil Singh. I author this blog. I'm Active Blogger, Programmer. I love learning new technologies, programming, blogging and participating the forum discussions more...
My Blogs - and
My Books - Interview Questions and Answers Books- Get Your Book in 15+ Digital Stores Worldwide..

You Might Also Like Powered by Blogger.
ASK Questions