Solution to the conflict between the template view and AngularJS this article describes the solution to the conflict between the template view and AngularJS. We will share this with you for your reference. The details are as follows:
Problem:
In the mvc view of php, we need
Pass some data to the template:
For example:
Here is a controller
$data['users'] = {something from databases};$this->load->view('home/index',$data);
Here is the corresponding View
- Name?> : Email?>
-
- {User. name }:{ {user. email }}
Now, how can we deal with the conflict between 1 and 2?
Solution 1:
《script》 var usersPrefetch = [
{"name": "
name?>", "email": "
email?>"},
];《script》
We store the data transmitted from php in the variable, and then use
$ Scope assigns a value to it, OK
Solution 2 (recommended ):
We use the ng-if attribute to solve our problem. php data is called when users is undefined.
After ajax is passed, use our data and define $ scope. users
- {{user.name}}:{{user.email}}