S
S
Semyon Kataparov2016-04-24 13:44:59
JavaScript
Semyon Kataparov, 2016-04-24 13:44:59

How to make the text received through foreach shorter?

How to make the text received through foreach shorter?
Here is the function:

$scope.minifyText = function (text, length) {
        return text.slice(0, text.indexOf(' ', length)) + '...';
    }

It is necessary for example:
{{ market_name }}
to deduce through this function is shorter.

Answer the question

In order to leave comments, you need to log in

4 answer(s)
A
Alexey Yarkov, 2016-04-24
@truexizt1

var maxlength = 20;
$scope.cutString = function (text) {
  if (text && text.length > maxlength) {
    return text.substring(maxlength) + '...';
  }
  return text;
};

K
kn1ght_t, 2015-04-28
@a4gg

a {
    display:block;
}

I
Ivan-P, 2015-04-28
@Ivan-P

Your question is not entirely clear. Maybe this?

li {
    cursor: pointer;
}

U
Umar Mukhamedaliyev, 2015-04-29
@umarishe

I'm not much of an expert, but still...

<ul id="navigation">
                <li><a href="1.html" class="button">1</a></li>
                <li><a href="2.html" class="button">2</a></li>
                <li><a href="3.html" class="button">3</a></li>
            </ul>

And here is the CSS:
.button {
    user-select: none;
    display: block;
    color: inherit;
    text-decoration: none
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question