Posts

Showing posts with the label angularjs

Post ngRepeat Code

all those questions, How to run function after ngRepeat is done Calling a function when ng-repeat has finished ng-repeat finish event all the answers in stackoverflow goes around <ul> <li ng-repeat = "item in items" ng-init = "$last ? doSomething() : angular.noop()" > {{item}} </li> </ul> which are nice and are a real solution, while each answer eventually give the same solution a bit more generic. one blog puts it quite better, while also enabling to choose the digest cycle stage, with the exception that you better use $parse instead of $eval: http://www.bennadel.com/blog/2592-hooking-into-the-complete-event-of-an-ngrepeat-loop-in-angularjs.htm but in the end we usually just do some simple JS or JQ code or plugin, and i think that the real solution here is a simple setTimeout since the setTimeout function gets pushed to the end of the queue of the browser, its always right after everything is done in angular, usu...

sharepoint 2013 and angular js - development tutorial

so we want to just do an SPA with angular for the "front end" site, and leave SP as a CMS well unless you put he main html file in the root, as in <server>\index.html, you will get a download everytime you try to browse to the file. this is a security feature and can be canceled with simple PS from here https://gist.github.com/wpsmith/484eb67652b3c928940d . the example is about html files. next thing, SP-wise, is getting your data. there you have 2 options, the "regular" rest api and the search rest api. the search, for getting data, is much faster, but you need to activate the search. url for search will always be like this /_api/search/query?querytext=<your query>&selectproperties='<Title,ListItemID, ect.>' notice that in the search you dont have the standard "Id" property but ListItemID. to map this enormous object to something normal, you can create a simple mapping function var toNormalItem = function ( ce...

simple light box directive for angular

improved to 2 modes, simple that knows to listen to parent click, no configuration needed. 2nd mode with some config to enable modal like workflow. here is the git here is the plunker

angular ng-show with slide

if you just want the final solution jump to the end, or this final jsBin: http://jsbin.com/jukogewobo/5/ . NOW IN GITHUB https://github.com/bresleveloper/bNgSlide a common case in web dev is the "Mega Menu", while you have a menu bar that should open under it another big menu. for this tutorial all my examples are shown in JSBINs, each part has its own link. the basic html I am using for part 1 looks like this:     < li ng-repeat ="level1 in data"         ng-mouseenter ="toggle($event, true)"         ng-mouseleave ="toggle($event, false)">              < div > //html  </ div >     </ li > the "li" is the repeater and event fire, and in the "div" the content to show/hide. part 1: simple logic (JSBIN) in Example 1 we see the "simple" solution with show/hide, nothing much to te...