조금 짧게 : 유성에 Meteor_angularjs 패키지를 사용하지 않고 Meteor + Blade과 함께 AngularJs를 사용하고 있습니다. 블레이드는 서버에서 페이지의 본문을 구성한 다음 클라이언트에서 수동으로 부트 스트랩합니다.Intercept Meteor + Blade와 함께 사용하기위한 앵귤러 템플렛 로딩
블레이드에는 클라이언트에서 쉽게 렌더링 할 수 있도록 Template['template_name']
에서 사용할 수있는 템플릿 파일이 있습니다. 나는 다음과 같이하고 싶다 :
div(ng-include='content.blade')
// HTML => <div ng-include='content.blade'></div>
그리고 어떻게 든 작동하게 만든다. 내가 그 템플릿의 컴파일 된 HTML을 반환해야합니다 조건
if(URI ends with '.blade') then
name <- strip '.blade' in URI
return Template[name]()
에게 각 정적 템플릿하게 XHR 요청을 가로 채고 추가 할 수있을 수 있다고 생각 새로운 전술 지시를 만드는
호환성을 유지하고 있지.
는 UPDATE :
은 공교롭게도 나는 $ templateCache에 달려 지금은 길을 가야하는 것 같아요.
유성 - 각도 통합에 사용할 'ngMeteor'모듈을 만들었습니다.
angular.element(document).ready ->
angular.bootstrap document, ['app']
app = angular.module 'app', ['ngMeteor.blade'], ->
app.controller 'mainCtrl', ($scope,$templateCache) ->
$scope.content = $templateCache.get "content.blade" # Works!!
블레이드 (body.blade가) : 내 응용 프로그램에서
angular.module 'ngMeteor',[], ->
throw 'Meteor object undefined.' unless Meteor? # Is it fine to put here?
angular.module('ngMeteor.blade',['ngMeteor']).
run ($templateCache) ->
$templateCache.put "#{name}.blade", render() for own name, render of Template
지금은 작동
#main(ng-controller='mainCtrl') {{ content }}
, 나는 $ templateCache을 주입 한 후 컨트롤러에서 렌더링 템플릿을 얻을 수 있으며, 이름으로 템플릿을 가져 오지만 ng-include
은 여전히 작동하지 않습니다.
마침내 완벽한 각도 + 유성 + CoffeeScript + 블레이드 + 스타일러스 콤보가 작동하는지 봅시다. – olanod