尝试使用双向数据绑定使用指令中的自定义代码更改 material md-selected 选项卡

Trying to change the material md-selected tab using custom code from directive using two way data binding

我正在尝试使用代码更改选项卡,但似乎无法找出错误。如果我们使用控制器来更改变量,基本的事情是有效的,但是当我尝试通过指令绑定它时,它坏了。

var app = angular.module('MyApp', ['ngMaterial']);
app.controller('HelloCtrl', function($scope) {
  $scope.selectedTab = 0;
});
app.directive('something', function() {
  return {
    restrict: 'E',
    template: '<div ng-click="changeNavigation()">Change Navigation</div>',
    scope: {
      selectedTab: '='
    },
    controller: function($scope) {
      $scope.changeNavigation = function() {
        console.log('Hello World');
        $scope.selectedTab = 2;
      };
    }
  };
});

您可以在codepen上查看有错误的工作代码:http://codepen.io/piyushchauhan2011/pen/rVRqeV?editors=101

错误是:

将参数传递给您的指令时,将 selectedTab="selectedTab" 更改为 selected-tab="selectedTab"

看到这个工作 fiddle:http://jsfiddle.net/2yd9u7b9/