Join the Stack Overflow Community
Stack Overflow is a community of 6.6 million programmers, just like you, helping each other.
Join them; it only takes a minute:
Sign up

This is my code that does not getting options for md-select. This html is not the main page. This is my first angularjs application, I am new to angular js, please help me.

Is there anything do i need to add?

<!DOCTYPE html>
<html lang="en">
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular-animate.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular-route.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular-aria.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular-messages.min.js"></script>
<script src="http://cdn.rawgit.com/angular/bower-material/v0.10.0/angular-material.js"></script>
<link rel="stylesheet" href="http://cdn.rawgit.com/angular/bower-material/v0.10.0/angular-material.css"/>
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link rel="stylesheet" href="https://code.getmdl.io/1.3.0/material.indigo-pink.min.css">
<script defer src="https://code.getmdl.io/1.3.0/material.min.js"></script>
<script language="javascript">
angular
.module('firstApplication', ['ngMaterial'])
.controller('openTicketController', openTicketController);

function openTicketController ($scope) {
$scope.departments = [
        {id: 1, type: 'IT'},
        {id: 2, type: 'Networking'},
        {id: 3,type: 'Accounts'},
        {id: 4,type: 'Sales'},
        {id: 5,type: 'Support'}
    ];
}
</script>
<style>
#inputDiv{
margin-left: 20px;
margin-right: 20px;
}
.inputCard{
padding: 5px;
}
</style>
</head>
<body ng-controller="openTicketController">
<md-tabs class="md-primary" md-dynamic-height >
<md-tab id="userTab">
<md-tab-label>User</md-tab-label>
<md-tab-body >
<div layout="row" layout-sm="column" class="md-padding" style="background-color: #fafafa">
    <div id="inputDiv" flex class="md-padding" >
        <md-card class="inputCard" >
            <md-input-container class="md-block" >
                <label >Ticket Summary</label>
                <input md-maxlength="45" required name="summary" ng-model="ticket.summary" >
            </md-input-container >
            <md-input-container class="md-block">
                <label >Ticket Description</label>
                <input md-maxlength="500" required name="description" ng-model="ticket.description">
            </md-input-container>
            <div layout="row" >
                **<md-input-container >
                    <md-select ng-model="selectedDepartment">
                        <md-option ng-value="varValue" ng-repeat="varValue in departments"> {{varValue.type}}</md-option>
                    </md-select>
                </md-input-container>**
            </div>
        </md-card>
    </div>
    <div flex="40" class="md-padding">
        <md-card><h6>sssss</h6>
        </md-card>
    </div>
</div>
</md-tab-body>
</md-tab>
<md-tab id="internalTab">
<md-tab-label>Internal</md-tab-label>
</md-tab>
</md-tabs>

</body>
</html>

please help

share|improve this question

There are few issues,

(i) Dependencies are missing for angular material (ii) As Mahesh mentioned you should mention ng-app in the view

DEMO

angular.module('firstApplication', ['ngMaterial'])
 .controller('openTicketController', openTicketController);
 function openTicketController ($scope) {
     $scope.departments = [
     {id: 1, type: 'IT'},
     {id: 2, type: 'Networking'},
     {id: 3,type: 'Accounts'},
     {id: 4,type: 'Sales'},
     {id: 5,type: 'Support'}
   ];
 }
#inputDiv{
                margin-left: 20px;
                margin-right: 20px;
            }
            .inputCard{
                padding: 5px;
            }
<!DOCTYPE html>
<html ng-app="firstApplication">
<head>
   <link data-require="[email protected]" data-semver="0.11.0" rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/angular_material/0.11.0/angular-material.min.css" />
  <script data-require="jquery@*" data-semver="2.1.4" src="http://code.jquery.com/jquery-2.1.4.min.js"></script>
  <script data-require="angular.js@*" data-semver="1.4.5" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.5/angular.min.js"></script>
  <script data-require="[email protected]" data-semver="0.11.0" src="https://ajax.googleapis.com/ajax/libs/angular_material/0.11.0/angular-material.min.js"></script>
  <script data-require="[email protected]" data-semver="1.4.1" src="https://code.angularjs.org/1.4.1/angular-animate.js"></script>
  <script data-require="[email protected]" data-semver="1.4.1" src="https://code.angularjs.org/1.4.1/angular-aria.js"></script>
  <script src="script.js"></script>
</head>
<body ng-controller="openTicketController">
  <md-tabs class="md-primary" md-dynamic-height >
        <md-tab id="userTab">
            <md-tab-label>User</md-tab-label>
            <md-tab-body >
                    <div layout="row" layout-sm="column" class="md-padding" style="background-color: #fafafa">
                        <div id="inputDiv" flex class="md-padding" >
                            <md-card class="inputCard" >
                                <md-input-container class="md-block" >
                                    <label >Ticket Summary</label>
                                    <input md-maxlength="45" required name="summary" ng-model="ticket.summary" >
                                </md-input-container >
                                <md-input-container class="md-block">
                                    <label >Ticket Description</label>
                                    <input md-maxlength="500" required name="description" ng-model="ticket.description">
                                </md-input-container>
                                <div layout="row">
    <md-select placeholder="Select" ng-model="model">
      <md-option ng-repeat="category in departments" value="{{category}}">
        {{category.type}}
      </md-option>
    </md-select>
  </div>
                            </md-card>
                        </div>
                        <div flex="40" class="md-padding">
                            <md-card><h6>sssss</h6>
                            </md-card>
                        </div>
                    </div>
            </md-tab-body>
         </md-tab>
        <md-tab id="internalTab">
            <md-tab-label>Internal</md-tab-label>
        </md-tab>
       </md-tabs>
</body>

</html>

share|improve this answer
    
Thanks for the reply,, ng-app is there in my main web page. We have to give ng-app only one time in web application. Correct me if i am wrong. The above didnot work for me. please help – user5594218 15 hours ago
    
i have added the demo check. did you add those references? – Sajeetharan 15 hours ago
    
Yes, i have added those, but not getting. if i give direct options inside options tag it is working, but from script not working. – user5594218 15 hours ago
    
No access in office – user5594218 15 hours ago

Include ng-app in body tag.

<body ng-app="firstApplication" ng-controller="openTicketController">
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.