angularjs and Github

Create a commit for the first time:
cd to the project, execute the following command
touch README.md
git init
git add README.md
[git add before committing, Git has a staging area where you can put newly added files or add new changes]
git commit -m""
[Submit the changes that have been added]
git remote add origin http://git.oschina.net/w136/company
git push -u origin master


[Common error]
①//After submitting, prepare to push Error: Unable to
push some refs to '[email protected]:joesGit15/learngit'
Hint: Update rejected because the remote repository contains commits that do not yet exist locally. This is usually because of another
hint: a repository has already pushed to this reference. Before pushing again, you may need to integrate the remote changes.
//According to the prompt, we need the git pull command to view the conflicting content. Sometimes, it will be merged automatically, and sometimes the conflict needs to be resolved manually (follow the prompts OK)
②If the push fails, because the remote branch is newer than your local one, you need to use git pull to try to merge first;
if there is a conflict in the merge, resolve the conflict and submit it locally; if there is
no conflict or resolve the conflict, then use git push origin branch-name push will be successful!





[Sync to server]
Before synchronizing to the server, you need to synchronize the server code to the local
  Command: git pull
If the execution fails, follow the prompts to restore the conflicting files, and then try to synchronize again.
  Command: git checkout -- <conflicting file path>

Synchronize to the server
Command: git push origin <local branch name>
If the execution fails, it is generally caused by not synchronizing the server code to the local, execute the above git pull command first.

 

 

(1) Filter:

  (convert data)

currency formats the number in currency format

filter selects a subset from an array of items

lowercase format string to lowercase

orderBy arranges an array according to an expression

uppercase format string to uppercase

The orderBy filter arranges the array according to the expression (note) orderBy:'id'[:true optional, if true, descending order, not filling in ascending order]

Can be added to expressions, directives

 

Filter input:

Input filters can be added to directives by a pipe character (|) followed by a filter followed by a colon and the model name (ng-model)

filter filter to select a subset from an array

 

(extended):

①date format {{1490161945000 | date:"yyyy-MM-dd HH:mm:ss"}} // 2017-03-22 13:52:25

②number format (retain decimals) {{149016.1945000 | number:2}}

③ currency currency format:

    {{ 250 | currency }} //result: $250.00       

    {{ 250 | currency:"RMB ¥ " }} // Result: RMB ¥ 250.00

④limitTo interception

    {{"1234567890" | limitTo :6}} // intercept 6 digits from the front

    {{"1234567890" | limitTo:-4}} // intercept 4 digits from the back

 

(2) Select (drop-down selection box):

The ng-option command creates a drop-down list, and the list items are output through the object and array loop, and ng-init sets the default selected value, which is written in the <select> tag

 

(3) Form:

①ng-repeat instruction can perfectly display the table

② Sort display, you can use the orderBy filter or other filters

Table display serial number: add $index in <td>

<table>
  <tr ng-repeat="x in names">
    <td>{{ $index + 1 }}</td>
    <td>{{ x.Name }}</td>
    <td>{{ x.Country }}</td>
  </tr>
</table>

  

 $odd is true when $index is odd, $even is true when $index is even

<tr style="{{$even?'background-color: red':''}}" ng-repeat="x in names">//Not even-numbered lines red

 

(4) Controller:

The ng-controller directive defines the application controller, using the $scope object to invoke the controller

The $scope of the controller (equivalent to scope, control scope) is used to save the object of the Model (model)

The controller creates two properties firstName and lastName in the scope

The ng-model directive binds input fields to controller properties (firstName and lastName)

The html page {{fullName()}} will call the method function in the controller

Usually the controller is stored in an external file and then used

<script src='**.js'></script>

 to call

 

(5) Scope (scope):

$rootScope (root scope) can act on the entire application and is a bridge between the scopes in each controller. The value defined with rootscope can be used in each controller

When creating a controller, pass $rootScope as a parameter, which can be used in the app

 

 (6) Cross-domain HTTP request:

If you need to get data from different servers (different domain names), you need to use cross-domain HTTP requests

Cross-domain requests are very common on web pages, many web pages load CSS, images, Js scripts, etc. from different servers

In modern browsers, for data security, all requests are strictly limited to the same domain name. If you need to call data from different sites, you need to solve it through cross-domain

The following PHP code runs using the website for cross-domain access

header("Access-Control-Allow-Origin: *")

 

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326689792&siteId=291194637