angularJS 单页面 两个及以上个 ng-app 的处理方式
<div ng-app="myApp1" ng-controller="myCtrl1">
名: <input type="text" ng-model="firstName"><br>
姓: <input type="text" ng-model="lastName"><br>
<br>
姓名: {{firstName + " " + lastName}}
</div>
<br><br>
<div ng-app="myApp2" ng-controller="myCtrl2">
名: <input type="text" ng-model="firstName"><br>
姓: <input type="text" ng-model="lastName"><br>
<br>
姓名: {{firstName + " " + lastName}}
</div>
<br><br>
<div ng-app="myApp3" ng-controller="myCtrl3">
名: <input type="text" ng-model="firstName"><br>
姓: <input type="text" ng-model="lastName"><br>
<br>
姓名: {{firstName + " " + lastName}}
</div>
<script>
//定义模块应用
var app = angular.module('myApp1', []);
//定义控制器应用
app.controller('myCtrl1', function($scope) {
// $scope相当于作用域、控制范围,是用来保存Model的对象
$scope.firstName= "qiu";
$scope.lastName= "su";
});
var app2 = angular.module('myApp2', []);
//定义控制器应用
app2.controller('myCtrl2', function($scope) {
// $scope相当于作用域、控制范围,是用来保存Model的对象
$scope.firstName= "qiu";
$scope.lastName= "su";
});
//手动地让第二个div被myapp2管理
angular.bootstrap(document.querySelector('[ng-app="myApp2"]'), ['myApp2']);
var app3 = angular.module('myApp3', []);
//定义控制器应用
app3.controller('myCtrl3', function($scope) {
// $scope相当于作用域、控制范围,是用来保存Model的对象
$scope.firstName= "qiu";
$scope.lastName= "su";
});
//手动地让第三个div被myapp3管理
angular.bootstrap(document.querySelector('[ng-app="myApp3"]'), ['myApp3']);
</script>
angularJS 单页面 两个及以上个 ng-app 的处理方式的更多相关文章
- AngularJS单页面路由配置恩,理解了就很简单啦
利用route实现单页面跳转功能 利用angularJS开发流程 1)配置好angularJS开发环境 2)利用 yo angular projectname创建项目目录 3)删除掉系统自动生成的一些 ...
- vue 单页面应用实战
1. 为什么要 SPA? SPA: 就是俗称的单页应用(Single Page Web Application). 在移动端,特别是 hybrid 方式的H5应用中,性能问题一直是痛点. 使用 SPA ...
- 基于angularJs的单页面应用seo优化及可抓取方案原理分析
公司使用angularJs(以下都是指ng1)框架做了互联网应用,之前没接触过seo,突然一天运营那边传来任务:要给网站做搜索引擎优化,需要研发支持.搜了下发现单页面应用做seo比较费劲,国内相关实践 ...
- ABP示例程序-使用AngularJs,ASP.NET MVC,Web API和EntityFramework创建N层的单页面Web应用
本片文章翻译自ABP在CodeProject上的一个简单示例程序,网站上的程序是用ABP之前的版本创建的,模板创建界面及工程文档有所改变,本文基于最新的模板创建.通过这个简单的示例可以对ABP有个更深 ...
- AngularJS进阶(二十五)requirejs + angular + angular-route 浅谈HTML5单页面架构
requirejs + angular + angular-route 浅谈HTML5单页面架构 众所周知,现在移动Webapp越来越多,例如天猫.京东.国美这些都是很好的例子.而在Webapp中,又 ...
- 基于AngularJs的单页面程序
基于AngularJs的单页面程序 在Abpzero的后台管理系统是一个AngularJs的单页面程序.当你登陆后,系统会跳转到"ApplicationController",然后 ...
- AngularJS中的route可以控制页面元素的改变,使多页面变成一个单页面。。。
SPA(Single Page Application)指的是通单一页面展示所有功能,通过Ajax动态获取数据然后进行实时渲染,结合CSS3动画模仿原生App交互,然后再进行打包(使用工具把Web应用 ...
- 关于js单页面实现跳转原理以及利用angularjs框架路由实现单页面跳转
还记得我们刚开始学习html时使用的锚节点实现跳转吗? <a href="#target">我想跳转至目标位置</a> <p>第一条</p ...
- AngularJs(SPA)单页面SEO以及百度统计应用(上)
只有两种人最具有吸引力,一种是无所不知的人,一种是一无所知的人 问:学生问追一个女孩总是追不上怎么办?回答:女孩不是追来的,是吸引来的,你追的过程是吸引女孩的过程,如果女孩没有看上你,再追都是没有用的 ...
随机推荐
- Ubuntu Server 中实际内存与物理内存不相等的问题
记录 来源 v2ex,提到了一个平时不是很起眼的问题,Ubuntu Server 中系统默认会占用 128M 内存,用于 CVM 内部的 kdump 服务. 科普 查看 CVM 所拥有的物理内存 通过 ...
- Python web前端 02 CSS
Python web前端 02 CSS 一.选择器 1.CSS的几种样式(CSS用来修饰.美化网页的) #建立模板 复制内容--->SETTING---> Editor -----> ...
- Olesya and Rodion (思维)
Olesya loves numbers consisting of n digits, and Rodion only likes numbers that are divisible by t. ...
- [原创]Aop之使用Autofac+Castle 自动注入服务且动态代理服务实现拦截(非MVC控制器拦截)
public static class AutofacComponentManualRegister { /// <summary> /// 注册 /// </summary> ...
- [转] linux下shell中使用上下键翻出历史命名时出现^[[A^[[A^[[A^[[B^[[B的问题解决,Linux使用退格键时出现^H解决方法
[From] https://www.zmrbk.com/post-2030.html https://blog.csdn.net/suifengshiyu/article/details/40952 ...
- Tomcat SSL证书安装配置
[From Internet] 首先找到安装Tomcat 目录下该文件“Server.xml”,一般默认路径都是在Conf 文件夹中.然后用文本编辑器打开该文件,接着找到 <Connector ...
- phantomjs的和谷歌浏览器的简单使用
一.phantomjs的简单使用 ''' 什么是phantomJs:无界面的浏览器 ''' from selenium import webdriver from time import sleep ...
- encoding specified in XML prolog (UTF-8) is different from that specified in page directive (utf-8)
myeclipse下启动项目后出现错误:encoding specified in XML prolog (UTF-8) is different from that specified in pag ...
- 问题记录——java.lang.IllegalArgumentException: Illegal character in scheme name at index 0
以下http请求报错是因为,请求的地址前面有个空格.... 2019-01-09 03:30:23,154 ERROR [business.modules.merchantreportresult.s ...
- oracle 笔记---(一)
+查看主节点和副节点 oclumon manage -get MASTER REPLICA +查看当前的统计信息和保存的时间段 oclmon manage -get repsize +收集时间段内的节 ...