Skip to main content
 首页 » 编程设计

angular中eclipse 中 Angular Directive(指令)的 HTML 语法错误中属性名称后面必须跟有 ' = ' 字符

2025年05月04日57birdshome

嗨,我在这里面临一个奇怪的问题。我正在尝试在我的应用程序中应用 Angular 分页。我正在尝试实现代码示例 given here 我完美地添加了一切。我的应用程序是在 java spring 框架中。我的代码如下。我正在 eclipse mars 中运行代码。我的错误是

Attribute name "uib-pagination" associated with an element type "ul" must be followed by the ' = ' character.

<div class="imt_paginationCtr">      
   <ul uib-pagination total-items="bigTotalItems" ng-model="bigCurrentPage" max-size="maxSize" class="pagination-sm" boundary-links="true" num-pages="numPages"></ul> 
</div> 

JS 文件

var app=angular.module('formvalid', [ 'ui.utils','ngAnimate','ngSanitize', 'ui.bootstrap']); 
    app.controller('validationCtrl', function($scope, $http) { 
    $scope.totalItems = 64; 
        $scope.currentPage = 4; 
 
        $scope.setPage = function (pageNo) { 
            $scope.currentPage = pageNo; 
        }; 
 
        $scope.pageChanged = function() { 
            $log.log('Page changed to: ' + $scope.currentPage); 
        }; 
 
        $scope.maxSize = 5; 
        $scope.bigTotalItems = 175; 
        $scope.bigCurrentPage = 1; 
}); 

我无法理解这个问题。我哪里做错了?

浏览器中显示错误

Mon Mar 19 14:32:27 IST 2018 There was an unexpected error (type=Internal Server Error, status=500). Exception parsing document: template="workflow", line 256 - column 52

请您参考如下方法:

你的代码没有任何问题。 Eclipse 不够智能,无法识别这些指令。您可以禁用 HTML 验证 转到首选项 -> 验证并取消选中 HTML 的复选框,如下图所示。

enter image description here

或者您可以允许来自 Web -> HTML Files -> Validation 的指令,并将允许的指令添加到突出显示的输入框中。

enter image description here

如果您对其他编辑器开放,请尝试 VSCode用于您的 JS/UI 内容。