Question from the AngularJS test

How to access the parent scope in AngularJS

Medium

Given an application using ui-router and the following situation:

app.config(function($stateProvider) {
   $stateProvider
      .state("parent", {
         url: "/parent",
         controller: "ParentController",
         template: "Parent: <span ui-view></span>"
      })
      .state("parent.child", {
         url: "/child",
         controller: "ChildController",
         template: "{{string}}"
      });
});

app.controller('ParentController', function($scope) {
   $scope.string = "I am the parent scope";
});

app.controller('ChildController', function() {});

What will the page at the URL "/parent/child" display?

Author: Mathieu RobinStatus: PublishedQuestion passed 97 times
Edit
1
Community EvaluationsNo one has reviewed this question yet, be the first!