angularjs - angular directives comment section -


I am working on a website that displays many articles Each article has a comment section. I have been able to effectively rewrite the comments to DOM with recursion within a ng-repeat though, I should be able to click on a feedback button on any comment (they appear in nested fashion ) And insert a div below the clicked button. This will be a text field for comments in the field in which they want to submit and a button when this second button is clicked, the controller will save the comment to the database. I initially wanted to do this by adding DOM directly to the controller. However, after further research, this would be a direct violation of the MVC / MVW pattern. I believe the correct answer is to create a custom command. Please give me some information about how to do it correctly. Any other and all information will be very helpful thanks in advance.

You do not really need to direct it to get it.

html:

  & lt; Div ng-repeat = "articles in articles" & gt; & Lt; P & gt; {{Article.content}} & lt; / P & gt; & Lt; Input type = "text" ng-model = "article. Response" & gt; & Lt; / Input & gt; & Lt; Button ng-click = "send send (article)" & gt; Send & lt; / Button & gt; & Lt; / Div & gt;   

js:

  myApp.controller ("article controller", function ($ http) {$ scope.sendResponse = function (article) {console. Log (Article.response); $ http.post (URL, article);};});   

Of course, you can improve it by sending input and buttons and after the user clicks the reply button it can show.

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -