html कोड
& lt; div ng- click = "sortOrder ($ event, पूर्णनाम ') "वर्ग =" कर्नल- xs-2 sortable asc "& gt; & LT; अवधि & gt; नाम से & lt; / span & gt; & Lt; / div & gt; यहां जेएस कोड है
$ scope.sortOrder = function (ईवेंट, नाम) {var $ elem = $ (event.target); var c = $ elem.hasClass ('desc')? 'एसीसी': 'एड्स'; $ Elem.removeClass ('asc desc')। AddClass (सी); }
टेक्स्ट "itemprop =" text ">
इसके बजाय currentTarget का उपयोग करें: var $ elem = $ (event.currentTarget); वर्तमान लक्ष्य पर ईवेंट श्रोता बनने वाला तत्व है, लक्ष्य तत्व को ट्रिगर करने वाला तत्व है।
इसका अर्थ है कि यदि आप अवधि लक्ष्य अवधि होगी और यदि आप div पर क्लिक करेंगे तो लक्ष्य div हो जाएगा लेकिन दोनों मामलों में currentTarget div हो जाएगा। एक और आसान समाधान के बजाय ng-class का उपयोग करना है। HTML :
& lt; div ng-click = "changeSortOrder ()" class = "col-xs-2 sortable" एनजी-वर्ग = "सॉर्ट ओर्डर" & gt; & LT; अवधि & gt; नाम से & lt; / span & gt; & Lt; / div & gt; जेएस:
$ scope.sortOrder = 'asc'; $ scope.changeSortOrder = फ़ंक्शन () {$ scope.sortOrder = $ scope.sortOrder === 'एस्क'? 'Desc': 'एसीसी'; }; डेमो : आपके तर्क के साथ उदाहरण निर्देश में चला गया:
जेएस:
एप दि डायरेक्टिव ('माइसोर्ट', फंक्शन () {रिटर्न: स्कोप: सच्चा, लिंक: फंक्शन (स्कोप, एलीमेंट) {var डिफ़ॉल्टSortOrder = 'asc'; element.addClass (defaultSortOrder); var परिवर्तनसॉर्टऑर्डर = फ़ंक्शन ) {Var newOrder = element.hasClass ('asc')? 'Desc': 'asc'; element.removeClass ('asc desc')। AddClass (नया ऑर्डर);}; element.on ('click', changeSortOrder); दायरा। $ ('$ नष्ट', फ़ंक्शन () {element.off ('click', changeSortOrder);});}}}); HTML:
& lt; div class = "col-xs-2 sortable" my-sort & gt; & Lt; span & gt; तत्व 1 & lt; / span & gt; & Lt; / div & gt; & Lt; div class = "col-xs-2 sortable" my-sort & gt; & Lt; span & gt; एलिमेंट 2 & lt; / span & gt; & Lt; / div & gt; & Lt; div class = "col-xs-2 sortable" my-sort & gt; & Lt; span & gt; तत्व 3 & lt; / span & gt; & Lt; / div & gt; डेमो :
Popular posts from this blog
I'm in the middle of homework work and I'm stuck. At this point in my code, I think that I should have a GUI window that opens and allows me to type "inserted text number". Notice is not going anywhere but at this point, If I pass through the problem then it will be in a linked list. I am getting two of the same error for the lines. Add (index, element); And I can not seem to get past it, there is no suitable method for the error "add (int, java. string string)". Code is below, please advise. To clarify - this will not be a method error because it is a linked list. There should not be any way involved. import java.awt. *; Import java.awt.event. *; Import javax.swing. *; Import java.util. *; Import java.util.Scanner; Import java.util.LinkedList; Public class TopTenList JFrame {Private TopTenList tt; See the Private JTextArea list; Private JTextField cmdTextField; Private JTextField resultsTestfield; // This GUI window is the code for the public toptist...
I am using JPA 2.0 and getting the following code in the DAO layer: Public Zero Test () {string key = "status"; String [] Conditions = {"A", "B"}; & Lt; TestTable & gt; Results = Search (Keys, Conditions); } Public listing & lt; TestTable & gt; Search (string key, object value error) {string sql = "test ndf to testlet and jade nand." + Key + "in:" + key; TypedQuery & LT; TestTable & gt; Query = entityManager.createQuery (SQL, TestTable.class); Query.setParameter (key, Arrays.asList (valueArr)) / *** Error Line *** Return query.getResultList (); } In the above error line, it throws the following exception: java.lang.IllegalArgumentException: parameter value element [[Ljava.lang.String; @ cbe5bc] did not match the expected type [java.lang.String] Why is this expected type string while actually this string []? Please help! Note: This is derived from the normal routine and is a simplified code. I can no...
Yes, I know, there is a question with almost the same title, but it refers to a different situation. Error message) In my case, I have a .cpp file with a big named designation name (implementation details). There is a property class template with a static data member in that name space, which I need to access from outside the unknown namespace. I give it a little bit of meat: file.hpp namespace Bar {template & lt; Typename A & gt; Struct foo {static_assert (is_same & lt; a, float & gt; :: value} is_same & lt; a, double>: value, ""); Fixed zero set_static_var (a const & x); // ...}; } and file.cpp namespace {template & lt; Typename A & gt; Struct foo_traits {// supports the implementation of several static code bars: foo & lt; & Gt; Fixed A data; }; The template's & lt; & Gt; Float foo_traits & lt; Float & gt; :: datum; // No change if this is in the global namespace template & lt; & Gt; Doub...
Comments
Post a Comment