title: Why does Cesium viewer not display a model, when I add it?
body: <p>I have an application, which displays a 3D map of a city and the "Add building" button.</p>
  
  <p>When the user presses that button, a model of a building must be inserted into the map.</p>
  
  <p>But it doesn't - I see a selection marker at the correct place, but no actual building.</p>
  
  <p><strong>Method 1</strong></p>
  
  <p>I add the building using following code (see file <code>src\main\resources\static\js\myapp.js</code> the source code):</p>
  
  <pre><code>function addBuilding() {
    var position = Cesium.Cartesian3.fromDegrees(132.159633, 43.350116, 0.);
    createModel('/models/CesiumAir/Cesium_Air.gltf', position);
  }
  
  function createModel(url, position) {
      var heading = Cesium.Math.toRadians(135);
      var pitch = 0;
      var roll = 0;
      var orientation = Cesium.Transforms.headingPitchRollQuaternion(
          position, heading, pitch, roll);
  
      var entity = viewer.entities.add({
          name : url,
          position : position,
          orientation : orientation,
          model : {
              uri : url,
              minimumPixelSize : 128
          }
      });
      console.log("entity.model = " + entity.model);
      viewer.selectedEntity = entity;
  }
  </code></pre>
  
  <p>This didn't work, so I tried another method.</p>
  
  <p><strong>Method 2</strong></p>
  
  <pre><code>var scene = viewer.scene;
  var modelMatrix = Cesium.Transforms.eastNorthUpToFixedFrame(
      Cesium.Cartesian3.fromDegrees(132.159633, 43.350116, 0.0));
  var primitive = Cesium.Model.fromGltf({
                        url : '/models/CesiumAir/Cesium_Air.gltf',
                        modelMatrix : modelMatrix,
                        minimumPixelSize : 128,
                        appearance : new Cesium.DebugAppearance({
                            attributeName : 'normal'
                          })
                    });
  scene.primitives.add(primitive);
  </code></pre>
  
  <p>This didn't work, either.</p>
  
  <p>If I open the URL <code>http://localhost:8080/models/CesiumAir/Cesium_Air.gltf</code> in the browser, I can see some JSON output, so a broken link isn't the cause.</p>
  
  <p>I'd appreciate, if you told me, what I have to modify in my program to make adding of buildings work. The source code and the building instructions are available <a href="http://bit.ly/1RN7UKq" rel="nofollow noreferrer">here</a>. The application uses AngularJS, maybe Cesium and Angular interfere somehow.</p>
  
  <p>This <a href="http://youtu.be/EGGSFf7ThWM" rel="nofollow noreferrer">video</a> shows, how to reproduce this error.</p>
  
  <p><strong>Update 1:</strong> When I open the page I sometimes (but not always) get the following exception (when I enable stopping on uncaught exceptions):</p>
  
  <p><a href="https://i.stack.imgur.com/PYYS1.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/PYYS1.png" alt="Error"></a></p>