Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

169
Visualizações
In the multiple choice checkbox, I want a single value to be selected when the page is first opened. I couldn't. How can I?

In the multiple choice field, I want the value to be selected as soon as the page is opened for the first time. I am inexperienced in this. I could not do it. I would be glad if you help.

.cshtml code:

<div style="margin:5px 0;"></div>
                <a class="btn btn-default" style="width:100%" ng-show="queryRayonIdBool" ng-click="showRayon()">Choose department...<span class="glyphicon glyphicon-chevron-down pull-right"></span></a>
                <div class="listbutton" ng-show="ShowRayon">
                    <div class="listbox" data-offset-top="50">
                        <a class="btn btn-default allselectbutton" ng-click="checkrayon()">Select All</a>
                        <a class="btn btn-default allselectbutton" ng-click="checkrayonnot()">Remove All</a>
                    </div>
                    <div style="padding-top:20px;">
                        <div style="float:none;" ng-repeat="ray in rayons">
                            <label class="checkbox-inline">
                                <input ng-model="ray.checked2" type="checkbox" value="{{ray.Id}}" ng-click='Checked2(ray)' /><p>{{ray.title}}</p>
                            </label>
                        </div>
                    </div>
                </div>

.js code:

$scope.Checkedval2 = "";
$scope.CheckedId2 = "";
$scope.checkrayon = function () {
    $scope.CheckedId2 = "0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22";
    angular.forEach($scope.rayons, function (value, key) {
        value.checked2 = true;

    });
}


rayondata = [];
rayondata.push({ 'id': 0, 'title': "Choose Department... (All Departments)" });
arkadashttp.get(arkadasservice.appOrigin + "/api/RayonApi/GetList",
{})
.then(function (rdata, status) {

    angular.forEach(rdata, function (item) {
        rayondata.push({ 'id': item.Id, 'title': item.RayonName });

    });
});

$scope.ProcessedNames = rayondata;
$rootScope.rayons = rayondata;
$scope.showRayon = function () {
    $scope.ShowRayon = !$scope.ShowRayon;

}

How can I make a change so that the value I want is selected when the page is opened for the first time? Thank you very much in advance.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

You should be able to add checked to the element. This should have it selected by default on page load.

<input ng-model="ray.checked2" type="checkbox" value="{{ray.Id}}" ng-click='Checked2(ray)' checked />
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda