angular.module("myApp" , [subApp1]); //line1
import mycontroller from './mycontroller';
controller : myController //line 2
.controller('myController',['$scope','$http', myController]]); //line 3
<grid data-type="scope" data="mydata"></dashgrid>
Error: Uncaught (in promise) TypeError: Cannot read property 'columns' of undefined(…)
Yes, http is asynchronous.
Yes, the view is displayed without waiting for your get request to complete and you must thus make sure it works fine in that situation (by not displaying the grid while its data is not there, for example, using ng-if). The alternative is to use
resolve in the state configuration.
The controller is instantiated when the router switches to the home state.
Line 3 registers a controller to the module under the name 'myController'. Line 2 tells the router that the view of the home state is controlled by myController
Line 3 is necessary if you intend to use
ng-controller="myController" in some view, or if you want to configure a route by specifying the name of the controller rather than the controller function itself:
controller : 'myController'
controller : myController