ANGULARJS Study notes (make a message board)

Source: Internet
Author: User

Original address:

Beginner Anjularjs two days, while learning while writing the message board, only a level of reply nested. Demo Address

Here is a summary of the learning process and notes. In addition, look at This article will also have the harvest.

I think ANGULARJS is the implementation of PHP a lot of functions and methods, in addition to not directly manipulate the database, he has a lot of plug-ins can provide use, very powerful.

The problem I encountered:

1. When submitting to PHP using the $ () method, the PHP receive statement is this:

1 $shuju = file_get_contents(' Php://input ', true);

Search a lot, did not give a reasonable explanation, only know that it is possible. We usually use forms to submit past data to be received by $_post, which is the result of the different header submissions.

We used ANGULARJS to submit the past is JSON format data, header is Content-type:application/json

And the form form is submitted in the past: Multipart/form-data

The solution of course there are 2, one is that the above method can be received,$_POST = json_decode(file_get_contents(‘php://input‘),true);

Another is to modify the header, $httpProvider.defaults.headers.put[‘Content-Type‘] = ‘application/x-www-form-urlencoded‘;

View Articles

In addition, to do the submission of the form, look at this article will also help;

2, the 2nd problem encountered is the routing parameters

Since I do not use the Ui-router plugin, the native ng-router is not able to route nesting, but at present I do not need to embed a routine, only need to pass a simple number of parameters. In fact, it is not difficult, the following wording:

. When ('/replay/:cid/:name ', {templateurl: "tpl/form.html", Controller: "Formctrl"})

Receive in the controller

Liuyan.controller (' Formctrl ', function ($scope, $http, $routeParams) {$routeParams. CID;}

There's also a lot of reference to the official API documentation, as well as viewing the UI that has been implemented

The tutorial URL also has a:

There is also an article about JSON:

ANGULARJS Study notes (make a message board)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.