Add information into an array (angular js)

I'm having trouble inserting my data into the list array

angular.module('myApp', [])
    .controller("myCtrl", function($scope) {
        $scope.list = ["call naina", "eat food", "do less work", "take meds"];
        $scope.a = false;
        $scope.d = false;
        $scope.k = false;
        $scope.text = '';
        $scope.change = function() {
            $scope.a = !$scope.a;
        };
        $scope.changd = function() {
            $scope.d = !$scope.d;
        };
        $scope.remove = function(x) {
            $scope.list[x] = "";
        };
        $scope.add = function() {

            $scope.list[0].push($scope.text);
            $scope.k = true;
        };

    });

<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.12/angular.min.js"></script>
<div ng-app="myApp" ng-controller="myCtrl" >
   <input type=button value="add" ng-click="change()" />
   <input type=button value="delete" ng-click="changd()" />
   <div ng-show="!a && !d" ng-repeat="x in list">
      {{x}}
   </div>
   <div ng-show="d && !a" ng-repeat="x in list">
      <input type="checkbox" ng-click="remove($index)">{{x}}
   </div>
   <div ng-show="a && !d" >
      <input type="text" ng-model="text" placeholder="enter the work" />   <input type=button value="add" ng-click="add()" />
      <div ng-show="k" ng-repeat="x in list">{{x}}</div>
      .
   </div>
</div>

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Unable to access filteredItems from custom popup in uib-typeahead retrieval process

Issue with Retrieving Filtered Items from ng-repeat in Controller using $scope Despite trying to fetch filtered items from ng-repeat, the value of $scope.filteredItems appears as undefined when I log it to the console. I attempted to implement the solutio ...

Discover the position of an element in an array with the AngularJS filter

I have an array of data stored in $scope.domainRows: $scope.domainRows = [ { domainName: 'example1.com', domainDescription: 'example1.com desc'}, { domainName: 'example2.com', domainDescription: 'example2.com desc&ap ...

Show the TEXT in the upper right corner

I'm currently using bootstrap CSS. I have a header page where all the page links are displayed, and I want to show the LOGGED IN USER'S NAME IN THE TOP RIGHT CORNER. <li class="nav-item"><a class="nav-link text-dark"& ...

adjusting array based on screen size fluctuations

Imagine having two arrays of images named landscape_images[] and portrait_images[]. One is for the landscape view and the other for the portrait view. When the screen width is in landscape mode, the wide resolution images will be displayed on the body. C ...

Is there a way to transform this fixed alignment of divs, etc. into a responsive layout that automatically adjusts to different screen sizes? - Using HTML and CSS3

If you want to see the demo, you can check it out on JSFiddle by clicking on this link: JSFiddle Demo. This webpage utilizes Twitter's Bootstrap framework, which you can find more information about by visiting . When inspecting the stylesheet on JSF ...

Discover real-time results of accordions and their information as you search

I am looking to add a search functionality to filter through a list of accordions and their contents on my HTML page. I want the search box to be able to search both the accordion titles and the content within each accordion. This is my first time posting ...

GWT integration for TinyMCE

I've been attempting to incorporate TinyMCE with GWT's RichTextBox, but so far I haven't had any luck. The issue seems to be that GWT turns the Rich text area into a #document, rather than a standard textarea in HTML. Does anyone know how to ...

What could possibly be causing this element to shift side to side (in IE only) during the CSS animation?

UPDATE: Issue occurring on Internet Explorer 10, Windows 7 When using the transform property to adjust the horizontal position of an element during animation, the vertical value is updated as well. However, despite setting the horizontal value to the same ...

Updating text in JavaScript within a different HTML document

I am struggling to display the response from a REST request on an HTML page using JavaScript. However, the returned string is not being replaced on the HTML page as expected. JavaScript Code function sendDELrequest() { serviceID = $("#serviceID&q ...

I want to modify a script for toggling a div's visibility to utilize a select dropdown menu instead of radio buttons

CSS @charset "utf-8"; /* CSS Document */ body,td,th { font-family: "Gill Sans", "Gill Sans MT", "Myriad Pro", "DejaVu Sans Condensed", Helvetica, Arial, sans-serif; font-size: medium; } body form select { font-family: "Gill Sans", "Gill Sans MT", "Myriad ...

I'm struggling to locate the space that should be between these elements

After accidentally starting in quirks mode without declaring a doctype, I realized my mistake and corrected it by declaring a doctype. However, there is a persistent issue with a space between .car-box-img and car-box that I can't seem to locate in t ...

Switching up the Label Colors in Chart.JS

It's been a while since my last question, so please bear with me if I'm not following the rules. I've attached my current code and a reference image of the chart. I am completely new to working with ChartJS. The situation is a bit unique: t ...

"Implementing a Modular CSS Approach and Uniform Styling Across Your App

How can we handle the scenario of implementing specific styling for h1 tags within a modular CSS approach? In the past, this would have been achieved through inheritance in a single stylesheet. For example: .h1 { font-size: 3rem; /* more styles */ } .h2 { ...

Trouble arises when attempting to convert HTML into a PDF format

Currently, I am developing a billing application using Sails.js, Angular, and ejs. Everything is going smoothly, but now I have a pressing need to save the HTML invoice as a PDF. After hours of searching on npmjs, I came across the html-pdf package. It wa ...

Leveraging the power of AngularJS alongside Turbolinks

Incorporating AngularJS into my application with turbolinks has been a bit challenging. I've noticed that after a page change, new event listeners are not being initialized. Is there a solution to ensure everything works smoothly? Any help would be gr ...

Image feature in CI is not functioning properly

Today marks my initial venture into the world of CI, but I stumbled upon an issue while trying to utilize img(). Upon inspecting the page's resources, I noticed that the code calling the image appeared as <img src="http://::1/lat2/asset/images/ci_l ...

JS: The for loop will keep iterating even if the condition becomes false

Can anyone help me understand why my for loop is continuing even after the conditions are met? Unfortunately I can't share the entire file due to its size, but here is a snippet of the loops: for (var j = 0; j < depKeyArr.length; j++) { var di ...

Transform the appearance of a complex image by altering its color using CSS

In my quest to bring a unique functionality to life, I am looking to achieve the following: I want to layer two transparent images within a <div>: one representing an object and the other depicting a glowing effect around the object. When hovering ...

Limit not reached by substring function

When the character limit exceeds 20 characters, the substring function extracts the first 20 characters typed in the input. It replaces any additional characters that are entered after reaching the max limit of 20. In my program, however, I am able to con ...

Unable to Show the Contents of the Item - AngularJS

I'm in the process of developing an application that will showcase job details within a modal window based on the selected template. To achieve this, I've integrated ui.bootstrap and ui.router. However, I'm encountering difficulties in displ ...