scope1

by leozcx

HTML

<div ng-controller="EditController">
  <span>{{obj.message}}</span>
  <div ng-if="show">
    <span>Edit Message</span>
    <input ng-model="obj.message" />
  </div>
</div>

JavaScript

var myApp = angular.module('demo', []);
myApp.controller('EditController', function($scope) {
  $scope.obj = {
    message: 'hi there'
  };
  $scope.show = true;
})