应用ng-rate后,我在angular.js中收到错误

时间:2018-09-19 07:14:47

标签: angularjs

var module = angular.module('ngRateIt', ['ng']);

module
.directive('ngRateIt', ["$q", function( $q ) {
    'use strict';

/*jslint unparam:true */
var link = function ($scope, $element, $attrs) {

    if(!$attrs.readOnly){
        $scope.readOnly = function(){return false;};
    }

    if(!$attrs.resetable){
        $scope.resetable = function(){return true;};
    }

    if(!$attrs.beforeRated){
        $scope.beforeRated = function(){var d = $q.defer(); d.resolve(); return d.promise;};
    }

    if(!$attrs.rated){
        $scope.rated = function(){return;};
    }

    if(!$attrs.beforeReset){
        $scope.beforeReset = function(){var d = $q.defer(); d.resolve(); return d.promise;};
    }

    if(!$attrs.reset){
        $scope.reset = function(){return;};
    }

};

return {
    scope:{
        ngModel      : '=',
        min          : '=?min',
        max          : '=?max',
        step         : '=?step',
        readOnly     : '&?readOnly',
        pristine     : '=?pristine',
        resetable    : '&?resetable',
        starWidth    : '=?starWidth',
        starHeight   : '=?starHeight',
        canelWidth   : '=?canelWidth',
        cancelHeight : '=?cancelHeight',
        rated        : '=?rated',
        reset        : '=?reset',
        beforeRated  : '=?beforeRated',
        beforeReset  : '=?beforeReset'
    },
    replace: true,
    templateUrl: 'ngRateIt/ng-rate-it.html',
    require: 'ngModel',

    link: link,
    controller: 'ngRateItController'
};

显示错误

  

错误:[$ compile:tplrt]   http://errors.angularjs.org/1.5.8/ $ compile / tplrt?p0 = ngRateIt&p1 = ngRateIt%2Fng-rate-it.html

0 个答案:

没有答案