angularjs笔记

来源:互联网 发布:淘宝追评时间限制 编辑:程序博客网 时间:2024/05/22 06:16
一1first--------------------------------------------------------------------------------------------
$state.go("app.system.yjbbGzzyRwglBbgl",{data:JSON.stringify(row)});
.state('app.system.yjbbGzzyRwglBbgl', {    url: '/yjbb/gzzy/rwgl/bbgl/:data',    templateUrl: 'app/tpl/yjbb/gzzy/yjbbGzzyRwglBbgl.html',    resolve: load(['app/controllers/yjbb/gzzy/yjbb.gzzy.rwgl.bbgl.js', 'angularBootstrapNavTree'])

})

var obj=JSON.parse($stateParams.data);

当需要在不同页面传送参数时,可以在路由的路径上带上参数,并在跳转时将参数带过来为了避免格式的错误,最好

使用JSON.stringify()将其转换成字符串,需要接收时在相应页面用JSON.parse()方法转换成json对象。

stringify()用于从一个对象解析出字符串
parse用于从一个字符串中解析出json对象
二2second
$scope可以在相关联的js和html中传值,当需要传输的值较多时可以使用数组形式。例如:$scope.showInfo={}
三3third
ng-click="zsgs.coustom($event,'E9')
this.coustom=function ($event,id) {    };
绑定单击事件格式如上,this表示作用域,coustom是方法名,function的括号里是参数,$event是angularjs的自
定义事件
四4forth
想在页面中删除某个元素时,因为angular和jquery有冲突,所以要先把元素包装成angularjs元素,使用angular.element()
再使用anglarjs的删除函数。如remove()

1 0
原创粉丝点击