Angularjs 离子自定义指令范围

Angularjs 离子自定义指令范围,angularjs,ionic-framework,Angularjs,Ionic Framework,我正在爱奥尼亚应用程序中创建一个指令,并尝试根据一个参数加载templateurl。尽管在使用控制台日志时该属性存在,但在尝试使用它时,ionic返回错误: ionic.bundle.js:26794 TypeError: Cannot read property 'type' of undefined 这是我的指示: .directive('card', function() { return { restrict: 'E', templateUrl: function(

我正在爱奥尼亚应用程序中创建一个指令,并尝试根据一个参数加载templateurl。尽管在使用控制台日志时该属性存在,但在尝试使用它时,ionic返回错误:

ionic.bundle.js:26794 TypeError: Cannot read property 'type' of undefined
这是我的指示:

.directive('card', function() {
  return {
    restrict: 'E',
    templateUrl: function(element, attrs) {console.log(attrs);
      return 'views/types/' . attrs.type;
    },
    scope: {
      item: '=',
    },
    controller: function($scope) {
      console.log($scope);
    }
}});
HTML:


<card ng-repeat="note in notes" item="note" type="plaintext"></card>