javascript - How to run controller code after scope is compiled -
i have router runs controller when go url: #/create . have configured so: $routeprovider .when("/create", { templateurl: "templates/create", resolve: { form: function () { return { fields: [] }; } }, controller: "createcontroller" }) and inside controller load of components asynchroniously inside services , assign respective scope property. .controller(function ($scope, service /* other components */) { // code console.log($scope); // gives $rootscope service.get().load([["forms"]], $scope); // reaso passing scope service assign loaded data }) sometimes when refresh page have request modules, not have them assigned scope. after lots of debugging have found out problem. running trouble when template not compiled , instead of $scope getting $rootscope , modules assigned other/incorrect scope. question here is, how can run controller code after s...