Note that there are some explanatory texts on larger screens.

plurals
  1. POAngularjs ng-include not including any view
    primarykey
    data
    text
    <p>I keep trying to set my ng-include as follows:</p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html ng-app&gt; &lt;head&gt; &lt;title&gt;Demo&lt;/title&gt; &lt;script type="text/javascript" src="js/lib/angular.min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="js/lib/angular-resource.min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="js/controllers/app.js"&gt;&lt;/script&gt; &lt;link rel="stylesheet" type="text/css" href="css/bootstrap.min.css"/&gt; &lt;/head&gt; &lt;body&gt; &lt;h1&gt;Airports&lt;/h1&gt; &lt;div ng-controller="AppCtrl"&gt; &lt;div&gt; &lt;div&gt; &lt;ul&gt; &lt;li ng-repeat="airport in airports"&gt; &lt;a href="" ng-click="setAirport(airport.code)"&gt; {{airport.code}} - {{airport.name}} &lt;/a&gt; - &lt;a href="" ng-click="editAirport(airport.code)"&gt; Editar &lt;/a&gt; &lt;/li&gt; &lt;/ul&gt; &lt;p ng-show="currentAirport"&gt;Current airpot: {{currentAirport.name}}&lt;/p&gt; &lt;/div&gt; &lt;!--el ng include le indica que puede incluir un scope (.html)--&gt; &lt;div ng-include src="formURL"&gt;&lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>My JS script (app.js):</p> <pre><code>function AppCtrl ($scope){ $scope.airports={ "STL":{ "code":"STL", "name":"Lambert-St Airport", "city":"san louis", "destinations": [ "LAX", "MKE" ] } }; $scope.formURL= 'partials/form.html'; $scope.currentAirport = null; $scope.setAirport = function (code) { $scope.currentAirport = $scope.airports[code]; }; $scope.editAirport = function (code) { $scope.editing = $scope.airports[code]; }; } </code></pre> <p>And finally form.html</p> <pre><code>&lt;div ng-show="editing"&gt; &lt;h3&gt;Edit Airport&lt;/h3&gt; &lt;input ng-model="editing.name" value="" class="input-xlarge"/&gt; &lt;/div&gt; </code></pre> <p>I have tried to show the form, changing the url, writing the complete url but it doesn't seems to work. Although when I click on the airports, the page shows correctly.</p> <p>If anyone can point me in the right direction that'd be great. Sorry for the huge post, it needed a bit of explaining to make it coherent. Hopefully it makes sense. Thanks.</p> <pre><code>My directory: exampleAngular |_css |_img |_js |_controllers |_app.js |_lib |_angular.min.js |_angular-resource.min.js |_partials |_form.html |_airport.html |_index.html </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload