Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

chrome console question #2833


User avatar
0
peterlee created

Hi~

abp.services.app.articleUnit.getAriticleUnitById(1); <--id value, long type, primary key Object {} jquery.min.js:4 POST <a class="postlink" href="http://localhost:6240/api/services/app/articleUnit/GetAriticleUnitById">http://localhost:6240/api/services/app/ ... leUnitById</a> 400 (Bad Request) send @ jquery.min.js:4 ajax @ jquery.min.js:4 (anonymous) @ abp.jquery.js:20 Deferred @ jquery.min.js:2 abp.ajax @ abp.jquery.js:19 serviceNamespace.getAriticleUnitById @ GetAll?v=636267387017316749:966 (anonymous) @ VM19165:1 abp.js:350 ERROR: abp.js:350 Object {code: 0, message: "[Validation error]", details: "[Validation narrative title] ↵ - input is null! ↵", validationErrors: Array[1]}

how to id value test ?

it's my abp.service code is..

public async Task<string> GetAriticleUnitById(EntityDto<long> input) { var articleUnit = await _articleUnitRepository.GetAsync(input.Id);

        return  articleUnit.DisplayName.ToString();
    }

3 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    Your method is getting EntityDto as an input which is a class. So you can test it like this.

    abp.services.app.articleUnit.getAriticleUnitById({id:1})
    
  • User Avatar
    0
    peterlee created

    The test went well.

    I made the following angular code.

    Vm.getArticleUnitName = function (articleUnitId) { ArticleUnitService.getAriticleUnitById ({id: articleUnitId}) .then (function (result) { Return result; }); };

    The problem is that in the Data Grid

    { Name: app.localize ('ArticleCategory'), Field: 'articleCategory', MinWidth: 150, CellTemplate: '<Div> {{vm.getArticleUnitName (row.entity.articleCategory)}} </ div>' <- ? },

    ? I do not seem to be able to call it

    What is wrong

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    You can't use vm directly from cellTemplate. You need to call it like this.

    '<Div> {{grid.appScope.getArticleUnitName (row.entity.articleCategory)}} </ div>'
    

    if getArticleUnitName gets a class don't forget to call it like this.

    '<Div> {{grid.appScope.getArticleUnitName ({nameOfField: row.entity.articleCategory})}} </ div>'