jquery - Page load actions in angular -


i jquery background working on angular application currently. want include code did on page load in jquery store arrays in sessionobject. e.g.

  $(document).ready(function(e) {     storage.prototype.setobj = function(key, obj) {     return this.setitem(key, json.stringify(obj)) } storage.prototype.getobj = function(key) {     return json.parse(this.getitem(key)) } }); 

how can same in angular application. in advance.

you can using init function. in html file add following code -

<div ng-app="myapp">     <div ng-controller="myctrl" ng-init="init()">     </div> </div> 

then in main.js file, following -

var app=angular.module("myapp",[]) app.controller("myctrl",function($scope){ $scope.init(function () {     // add code here     }) }) 

Comments

Popular posts from this blog

database - VFP Grid + SQL server 2008 - grid not showing correctly -

jquery - Set jPicker field to empty value -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -