javascript - AngularJS pass variable through to a template -


i want pass variable or text through template shows value inside template.

i come across jsfiddle shows working uses ng-repeat. there simplere way without using ng-repeat?

<div ng-repeat="name in ['john']" ng-include="'partial.html'"></div> <div ng-repeat="name in ['jack']" ng-include="'partial.html'"></div>  <script type="text/ng-template" id="partial.html">    <div>the name {{ name }}</div> </script> 

http://jsfiddle.net/f97keutl/

<div ng-controller="ctrl">    <div ng-include="'partial.html'"></div> </div> <script type="text/ng-template" id="partial.html">    <div>the name {{ name }}</div> </script> 

js:

var myapp = angular.module('myapp',[]);  myapp.controller('ctrl', function($scope) {     $scope.name = "john";  }); 

you set variable in scope, , include template?


Comments

Popular posts from this blog

java - Oracle EBS .ClassNotFoundException: oracle.apps.fnd.formsClient.FormsLauncher.class ERROR -

c# - how to use buttonedit in devexpress gridcontrol -

nvd3.js - angularjs-nvd3-directives setting color in legend as well as in chart elements -