focusin, focusout : 버블링 발생함focus, blur : 버블링 발생안함 부모가 div고 내부에 input 요소가 있을때 input 요소에 focusin 되면 부모 div에도 그 이벤트가 전달된다. input 요소에 focus 되면 부모 div에는 그 이벤트가 전달되지 않는다. 정리 1. 동일한 결과를 예상하고 싶을때 focusin과 focusout를 함께, focus와 blur를 함께 사용하자. 2. input에 포커스되거나 잃어버렸을때, 부모요소에서 리스너를 동작하고 싶다면 focusin과 focusout을 사용하자. 123 cs 12345678910111213141516 $('.parent').focusin(function(){ console.log('부모 focusin!');});..
각 작품 클릭시 평점이 뜰 수 있게 click 이벤트를 줘봅시다. (ng-click 사용) 12345678910[ html ] {{ ${d}index+1 }} {{ webtoon.title }} {{ webtoon.cartoon.artists[0].name }} Colored by Color Scriptercs 123456789101112[ js ] webtoonApp.controller('webtoonListCtrl', function($scope, $http){ $http.get('json url here..').success(function(data){ $scope.webtoons = data.data.webtoons; }); //평점 메세지 $scope.showScore = function(sco..
$http(XMLHttpRequest)를 이용해 json 데이터를 받아오자. [ guide ]1234567891011121314151617181920212223//Simple GET request example :$http.get('/someUrl'). success(function(data, status, headers, config) { // this callback will be called asynchronously // when the response is available }). error(function(data, status, headers, config) { // called asynchronously if an error occurs // or server returns response..
Angular js로 반복문 표현시 팁입니다. 앞선 예제 이어서 해보겠습니다. 1234567891011121314 {{ webtoons.length }}개의 작품 {{ $index+1 }} {{ webtoon.title }} {{ webtoon.cartoon.artists[0].name }} Colored by Color Scriptercs 조건문ng-if : 예제에는 index 가 3미만인것만 표기했습니다. (총 3개 노출)webtoon.img ? webtoon.img : 'default.jpg' 등으로도 표현가능합니다. 반복문$index : index 표현$first : 첫번째 요소$middle : 첫번째나 마지막 제외한 요소 모두$last : 마지막 요소$even : 짝수번째 요소$odd : 홀수번..
Angular js로 이런걸 만들겁니다. 우선 해야할일은 Angular 모듈 지정 : html 에 ng-app 을 통해 선언해줍니다. (실제 마크업에는 data-ng-app으로 되어있는데 w3c 벨리데이터 통과를 위함) 12[ html ] cs 12[ js ]var webtoonApp = angular.module('webtoonApp',[]);cs view에 표현할 div에 컨트롤러 지정 : ng-controller 사용 (webtoonListCtrl) 12[html] cs 12[ js ]webtoonApp.controller('webtoonListCtrl', function(){});cs 컨트롤러에서 내려주는 model을 루프 돌려줌 : ng-repeat 을 통해 webtoons 배열 루프 12[ h..
요즘 프로젝트를 할때 Backbone 사용이 늘고있는 추세다. 국내에 Backbone만을 위한 도서는 없었는데(내가 알기로는) 최근에 번역서가 있는 것을 보고 구입했다. (근데 막상 사고보니 6개월도 전에 나왔었다니;;)이 책은 O'Reilly 에서 나온 Developing Backbone.js Applications 의 번역서다. 우선 한번 쭈욱 읽어봤는데 상당히 정리가 잘 되어있다. 번역의 매끄러움도 그렇거니와, js MVC 패턴을 이해하는데 도움을 준다.지금까지는 Backbone 공식 사이트에서 영어로 된 정보로 작업했었는데, 한글로 한번 싹 정리하기에 이만한 책이 없는듯 하다.(방금 알게 된 사실인데.. Backbone 공식 사이트의 번역 사이트가 있었더라는.. http://iwidgets.kr/..
- Total
- Today
- Yesterday