Hallo, ich bin mit Sterne-Option mit Formular AngularJS wie in dem folgenden jsfiddleReset-Sterne einreichen, nachdem er in AngularJS
<http://jsfiddle.net/manishpatil/2fahpk7s/>
alles in Ordnung arbeiten werden.
Aber ich möchte Sterne nach dem Formular auf den Standard zurücksetzen. kann mir jemand helfen, dies zu erreichen?
bitte meinen Code verweisen, wie ich diese Sterne
HTML implementieren:
Controller:function socialPostCtrl(socialPostService, userPersistenceService, $location, $sce) { var socialPostVM = this;
socialPostVM.maxRating = 5;socialPostVM.clickstar = function (param) { socialPostVM.rating = param ; };
// einreichen Post-Funktion
socialPostVM.addpost = function() {
angular.element (document.get ElementById ('addPostBtn')) [0] .disabled = true; var result = socialPostService.addpost (socialPostVM.loggedUserDetails.UserId, socialPostVM.takeawayGuid, socialPostVM.newpost, socialPostVM.attachment, socialPostVM.rating) .then (function (response) { if (response.Success) { var = newpost {}; newpost.postid = response.SocialPost.SocialPostId; newpost.postGuid = response.SocialPost.SocialPostGuid; newpost.profilepic = ""; newpost.postby = response.SocialPost.PostUser; newpost.postbyid = Antwort .SocialPost.UserId; newpost.poston = Antwort.SocialPost.PostDate; newpost.posttext = Antwort.SocialPost.PostContent; newpost.hasliked = Response.So cialPost.HasLiked newpost.totallikes = 0; newpost.comments = []; newpost.totalcomments = 0; newpost.showcommentbox = false; newpost.candeletepost = function() {return true; } newpost.hasAttachment = response.SocialPost.HaveMedia; if (response.SocialPost.HaveMedia) {
newpost.postattachment = $sce.trustAsResourceUrl(response.SocialPost.PostMedia.MediaFileName); } newpost.rating = socialPostVM.rating/socialPostVM.maxRating * 100; socialPostVM.socialposts.splice(0, 0, newpost); } }).finally(function() { socialPostVM.attachment = []; angular.element(document.getElementById('addPostBtn'))[0].disabled = false; angular.element(document.getElementById('posttext'))[0].value = ""; socialPostVM.filelist = []; }); };
Richtlinie.
angular.module ("test") Richtlinie ('Typs zu einem höheren', function() { return { einschränken: ‚E ‘, -umfang: { Bewertung: '=', maxRating: '@', schreibgeschützt: '@', Klick: "&" },
template: "<div style='display: inline-block; margin: 0px; padding: 0px; cursor:pointer;' ng-repeat='idx in maxRatings track by $index'> \ <img ng-src='{{((hoverValue + _rating) <= $index) && \"/images/star-empty-lg.png\" || \"/images/star-fill-lg.png\"}}' \ ng-Click='isolatedClick($index + 1)' \ ng-mouseenter='isolatedMouseHover($index + 1)' \ ng-mouseleave='isolatedMouseLeave($index + 1)'></img> \ </div>", compile: function (element, attrs) { if (!attrs.maxRating || (Number(attrs.maxRating) <= 0)) { attrs.maxRating = '5'; }; }, controller: function ($scope, $element, $attrs) { $scope.maxRatings = []; for (var i = 1; i <= $scope.maxRating; i++) { $scope.maxRatings.push({}); }; $scope._rating = $scope.rating; $scope.isolatedClick = function (param) { if ($scope.readOnly == 'true') return; $scope.rating = $scope._rating = param; $scope.click({ param: param }); }; } }
});
Dank
Hallo, danke für die Antwort. hier habe ich meinen Code in Frage gestellt. kannst du dir das bitte anschauen und mir sagen, wo ich diesen Reset durchführen muss – Lalitha