AngularJS - Format Text Return From JSON To Title Case

前端 未结 3 471
离开以前
离开以前 2021-02-03 20:29

I have a service that retrieves data from a JSON file.

Some of the data within the data is all in uppercase, for example:

$scope.FootballClubs = [{
    C         


        
3条回答
  •  野性不改
    2021-02-03 20:58

    Let me offer a non-directive way which is probably easier to implement but less powerful and dependent on the solution being UI only. First, change them to lowercase {{name.CompanyName.toLowerCase()}}

    I think the easiest way is to just have CSS format it (either via a style tag, class, etc).

    {{ name.CompanyName.toLowerCase() }}

    Here is a demo: http://plnkr.co/edit/S4xtIRApMjKe0yQGREq5?p=preview

提交回复
热议问题