<ul class="nav nav-pills tabscount">
<li ng-repeat="section in submissionCtlr.submissionForm.sections" ng-class="{ active:submissionCtlr.isSelected(section.sectionId) }" > <a href="" ng-click="submissionCtlr.selectTab(section.sectionId)">{{section.sectionName}}</a></li>
</ul>
<input type="submit" value="Submit" style="display:none" class="btn btn-primary" ng-click="submissionCtlr.submitForm()" ng-disabled="submitForm.$invalid">
this.tab=1;
this.selectTab = function(setTab){
var tabcount = $scope.submissionCtlr.submissionForm.sections.length;
if(this.tab != tabcount){
this.tab++;
}else {
}
On click next button i got count, at the end of li count need to submit. submit should be display and next should be display: none. how can i acheive in anugularJs.
您可以使用ng-show来判断当前的tab( tab
)是否与tabs的总数相同( submissionCtlr.submissionForm.sections.length
)。
<input type="submit" value="Submit" ng-show="submissionCtlr.tab==submissionCtlr.submissionForm.sections.length" class="btn btn-primary" ng-click="submissionCtlr.submitForm()" ng-disabled="submitForm.$invalid">
For modifying the DOM elements in angularjs. The proper way is to create a directive and access the element in that directive. For example -
<button class="btn btn-primary" ng-click="submit()" on-submit> Submit </button>
JS:
angular.module('myApp')
.directive('onSubmit', ,function() {
return {
restrict: 'A',
link: function($scope,el) {
$scope.submit = function() {
el[0].css("display", "none"); //change the css here accordingly.
}
}
};
});
You can also add the class like
element.addClass('myclass');
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.