Stack Overflow is a community of 4.7 million programmers, just like you, helping each other.

Join them; it only takes a minute:

Sign up
Join the Stack Overflow community to:
  1. Ask programming questions
  2. Answer and help your peers
  3. Get recognized for your expertise

My main html page is given below index.html

<!DOCTYPE html>
<html ng-app>
<head>
<meta charset="ISO-8859-1">
<title>Demo</title>
<script type="text/javascript" src="js/lib/angular.min.js"></script>
<script type="text/javascript" src="js/controllers/app.js"></script>
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="css/bootstrap-theme.min.css">
</head>
<body>
    <div class="container" ng-controller="AppCtrl">

        <h1>AngulAir</h1>

        <div>
            <ul>
                <li ng-repeat="airport in airports">
                <a href="" ng-click="setAirport(airport.code)">{{airport.code}}-{{airport.city}}</a>
                -<a href="" ng-click="editAirport(airport.code)">Edit</a>
                </li>
            </ul>
            <p ng-show="currentAirport">currentAirport:{{currentAirport.name}}</p>
        </div>
        <p ng-show="editing.name"><input type="text" ng-model="editing.name" value=""/></p>
        <div ng-include="sidebyURL"></div>
        <div ng-include="formURL"></div>

    </div>
</body>
</html>

and I am using javascript file as given below app.js which present inside js/controllers folder

function AppCtrl($scope) {
    $scope.airports = {
        "PDX" : {
            "code" : "PDX",
            "name" : "Portland International Airport",
            "city" : "Portland",
            "destinations" : [ "LAX", "SFO" ]
        },
        "STL" : {
            "code" : "STL",
            "name" : "Lampbert-St. Louis International Airport",
            "city" : "St. Louis",
            "destinations" : [ "LAX", "MKE" ]
        },
        "MCI" : {
            "code" : "MCI",
            "name" : "Kansas City International Airport",
            "city" : "Kansas City",
            "destinations" : [ "SFO", "LAX" ]
        },
    };

    $scope.currentAirport=null;
    $scope.sidebyURL='partials/airport.html';
    $scope.formURL='partials/form.html';
    $scope.setAirport = function(code) {
        $scope.currentAirport = $scope.airports[code];
    };
    $scope.editAirport = function(code) {
        $scope.editing = $scope.airports[code];
    };

}

and I am including 2 html files in the main index.html file that 2 files airport.html is

<div ng-show="currentAirport">
    <h3>{{currentAirport.name}}</h3>
    <h4>Destinations</h4>
    <ul>
        <li ng-repeat="destination in currentAirport.destinations">
            {{destination}}
        </li>
    </ul>
</div>

and another form.html is

<div ng-show="editing">
    <h3>Edit Airport</h3>
    <input type="text" ng-model="editing.name" value=""/>
</div>

and my 2 remaining html files are present in the folder partials and while executing index.html I am not able to include form.html and airport.html inside index.html file if you have any idea about these let me know thank you.....

share|improve this question
    
is there any error in console? which angular version you are using? try $scope.sidebyURL='/partials/airport.html'; – Pankaj Parkar Feb 2 '15 at 10:17
    
You can built your own custom directive to achieve whatever you want. – Toretto Feb 2 '15 at 10:29
up vote 0 down vote accepted

Did you actually set scope.editing and scope.currentAirport so the ng-show returns true? I've copied and pasted your code to plunker and works as expected

List: <button ng-repeat="airport in airports" ng-click="setAirport(airport.code)">{{airport.code}}</button>
    Edit: <button ng-repeat="airport in airports" ng-click="editAirport(airport.code)">{{airport.code}}</button>

http://plnkr.co/edit/wQt5wrTkE8YXwOaKacBq

share|improve this answer
    
k, its working in plunker but its not working using eclipse can you please check it in eclipse thank you – Tripuramallu Bhagyasri Feb 2 '15 at 10:53
    
sorry, i'm a WebStorm user – maurycy Feb 2 '15 at 12:18
    
its k I got output... and thank you – Tripuramallu Bhagyasri Feb 2 '15 at 13:16

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.