我正在寻找一种方法来使用Angular2获取当前URL的主机.等等
http://example.com/myapp.html
Run Code Online (Sandbox Code Playgroud)
我想得到:
example.com
Run Code Online (Sandbox Code Playgroud)
(在angular1中我使用$ location.host()来解析它.有类似的东西吗?)
我想在对象上添加一个方法(从NSManagedObject子类化)
@interface REMBox : NSManagedObject {
}
- (int)singleValueForIndex:(int)index;
@property (nonatomic,retain) NSString *name;
Run Code Online (Sandbox Code Playgroud)
但该方法不能使用
REMBox *box = ....
BOOL canCallMessage = [box respondsToSelector:@selector(singleValueForIndex:)];
// canCallMessage is NO
int a = [box singleValueForIndex:4];
// that crashes :-(
Run Code Online (Sandbox Code Playgroud)
我的错是什么 REMBox的正常(核心数据)属性运行良好.