I'm trying to edit view outside ng-controller element. I was able to solve it by using $rootScope and dom manipulations, but I want to know how it can be solved by native angularjs?
Html:
  <body>
    <div class="container">
      <div class="block" ng-controller="BlockController as block">
          <div><strong>Name:</strong> {{ block.name }}</div>
          <a href ng-click="block.edit()">Edit</a>
      </div>
    </div>
    
        
    <div class="container-editor">
      <div id="block-editor"></div>
    </div>
  </body>
Js:
  angular.module('app', [])
  .controller('BlockController', BlockController);
  function BlockController($compile, $scope)
  {
      this.name = 'default name';
      this.edit = function() {
          var $editor_html = ' <input type="text" ng-model="block.name" name="name" /> <a href ng-click="block.save()">Save</a>';
          $editor_html = $compile($editor_html)($scope);
          angular.element(document.querySelector("#block-editor")).html('').append($editor_html);
      };
      this.save = function() {
          // save block
          angular.element(document.querySelector("#block-editor")).html('');
      };
  }
here is example
 
     
    