When I want to initialize a variable the first time the controller starts, I do this in my view
<div ng-controller="testCtrl" ng-init="<%some var from server %>"> <div>
However, now I use ui-router as follows:
.state('index', {
url: "/",
templateUrl: "/register-form.html",
controller: "testCtrl"
})
Because I no longer show <div ng-controller=, etc., how else do I initialize and pass mine <%some var from server %>from the template? register-form.html no longer has a controller tag because ui-router takes care of that.
source
share