在 Polymer 入门 页面中,我们可以看到 Polymer 实战的一个例子:
<html>
<head>
<!-- 1. Shim missing platform features -->
<script src="polymer-all/platform/platform.js"></script>
<!-- 2. Load a component -->
<link rel="import" href="x-foo.html">
</head>
<body>
<!-- 3. Declare the component by its tag. -->
<x-foo></x-foo>
</body>
</html>
你会注意到<x-foo></x-foo>
由platform.js
和x-foo.html
定义。这类似于AngularJS中的指令模块。angular.module('xfoo', [])
.controller('X-Foo', ['$scope',function($scope) {
$scope.text = 'hey hey!';
})
.directive('x-foo', function() {
return {
restrict: 'EA',
replace: true,
controller: 'X-Foo',
templateUrl: '/views/x-foo.html',
link: function(scope, controller) {
}
};
});
这两者之间有什么区别?
Polymer解决了哪些AngularJS未解决或未能解决的问题?
是否有计划在将来将Polymer与AngularJS联系起来?