Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8772551
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T18:03:43+00:00 2026-06-13T18:03:43+00:00

I’m new to AngularJS. A long time I tried to abuse it the way

  • 0

I’m new to AngularJS. A long time I tried to abuse it the way I’ve always used Javascript-Frameworks like JQuery or Mootools. Now I understood that it’s not gonna work like that anymore… But I’ve come across some big problems since I always generate my HTML-output with a CMS.

So it’s pretty static, when it first comes out… Small example:

<ul>
 <li>foo <span>delete</span></li>
 <li>bar <span>delete</span></li>
 <li>blub <span>delete</span></li>
</ul>

Now I thought, that Two-Way Databinding means I can generate the View with help of the Angular Scope and Controller, but also can generate Models by the View.

I may got something confused there… So here’s my question. Is there any way to initiate Models from static HTML-output from a CMS?

I tried something like this…

<ul ng-controller="Ctrl">
 <li ng-init="item[0].name=foo">{{item[0].name}} <span ng-click="remove(0)">delete</span></li>
 <li ng-init="item[1].name=bar">{{item[1].name}} <span ng-click="remove(1)">delete</span></li>
 <li ng-init="item[2].name=blub">{{item[2].name}} <span ng-click="remove(2)">delete</span></li>
</ul>

And in my controller I wrote a delete function. But when it did delete, it did only delete the name… the span-button was still there

It did work though when I defined my data as an javascript-array and did the whole output via Angular with ng-repeat… like this:

<ul ng-repeat="it in item">
 <li>{{it.name}} <span ng-click="remove($index)">delete</span></li>
</ul>

I hope I made a point here and everyone get’s my dificulty and problems? Can anyone tell me if what I was trying there is possible at all?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T18:03:44+00:00Added an answer on June 13, 2026 at 6:03 pm

    This is a common issue people have adjusting to Angular and other frameworks like it.

    You don’t need your server to render the HTML for you anymore. All you need to do is set up the template, and load the proper data into the scope.

    <ul ng-controller="Ctrl" ng-init="getMyItems()">
     <li ng-repeat="item in items">{{item.name}} <a ng-click="remove($index)">delete</a></li>
    </ul>
    

    And in your controller you’d do something like this

    app.controller('Ctrl', function($scope, $http) {
       $scope.items = [];
       $scope.getMyItems = function(){
           $http.get('/my/json/stuff/url').success(function(data) {
               $scope.items = data;
               $scope.$apply();
           });
       };
    });
    

    Now I know you’re probably thinking “but I don’t want to make a seperate request to get my JSON. And that’s fine (probably irrelevant, but fine)… All you need to do is stick it into a global variable and retrieve it with $window instead.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am reading a book about Javascript and jQuery and using one of the
I am trying to render a haml file in a javascript response like so:
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
I've got a string that has curly quotes in it. I'd like to replace
I have a small JavaScript validation script that validates inputs based on Regex. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.