I have a directive that creates a button. When that button is clicked, it should update a variable firstName in the parent scope. I have already set $scope.firstName = "Test" in my controller.
The directive:
myApp.directive('myComponent', function(){
  return {
    scope: {
      firstName: '='
    },
    link: function(scope, element, attrs){
      // A function that should update a parent scope variable.
      scope.changeName = function(){
        scope.firstName = "Name was changed."
      }
    }),
    template: '<button ng-click="changeName">Test</button>'
  };
});
firstName should change here when the button is clicked, but it does not. Why does firstName not update?
<div>
  {{ firstName }}
  <my-component first-name="firstName"></my-component>
</div>
 
    