I'm making a selectbox in AngularJS but got a problem while using it in angular routing. I don't know where to put this script code because if I put script tag in main html then routing not working and if I put script tag in correspond html file then drop-down not working.
This is my code:
from index.html
<
!DOCTYPE html >
<
html lang = "en-US" >
<
head >
<
script src = "https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js" > < /script> <
script src = "https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular-route.js" > < /script> <
link rel = "stylesheet"
href = "https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" >
<
script src = "https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js" > < /script> <
script src = " https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" > < /script> <
style >
h1, h2, h3, h4, h5, h6 {
color: #585858; }
</style>
</head>
<body ng-app= "myApp" >
<
h3 class = "text-center main-heading" > Calculator < /h3> <
div class = "col-sm-12" >
<
div class = "row" >
<
div class = "col-sm-3" >
<
table class = "table table-bordered table-hover text-center" >
<
tbody >
<
tr > < td > < a href = "#/" > Home < /a></td > < /tr> <
tr > < td > < a href = "#painting" > painting < /a></td > < /tr> <
tr > < td > < a href = "#plastering" > plastering < /a></td > < /tr> <
/tbody> <
/table> <
/div> <
div class = "col-sm-9" >
<
div ng - view > < /div> <
/div> <
/div> <
/div> <
script src = "route.js" > < /script> <
/body> <
/html>
and
for other file where i want to use select box code is
<
div class = "col-sm-12"
ng - controller = "myCtrl" >
<
img src = "painting.png"
class = "img-responsive"
style = "width:100%;" >
<
div class = "clearfix" >
<
/div> <
div class = "col-sm-12 text-center" >
<
h3 > Select Material Type < /h3> <
/div> <
div class = "row" >
<
div class = "col-sm-4" >
<
div class = "form-group" >
<
label
for = "sel1" > Select Material Unit < /label> <
select class = "form-control"
id = "sel1" >
<
option value = "u1" > Meter < /option> <
option value = "u2" > Feet < /option> <
/select> <
/div> <
/div> <
div class = "col-sm-4" >
<
div class = "form-group" >
<
label
for = "sel1" > Select Category < /label> <
select ng - model = "selectedName"
class = "form-control"
ng - options = "x for x in names" > < /select> <
/div> <
/div> <
div class = "col-sm-4" >
<
div class = "form-group" >
<
label
for = "sel1" > Select Type Of Work < /label> <
select class = "form-control" > < /select> <
/div> <
/div> <
/div> <
/div> <
script >
var select = angular.module('myApp', []);
select.controller('myCtrl', function($scope) {
$scope.names = ["Emil", "Tobias", "Linus"];
}); <
/script>